Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
added dockerfile (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
excalibur-kvrv committed Nov 3, 2021
1 parent 74bb4e5 commit 1b52e9c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 41 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM jrottenberg/ffmpeg:4.1-ubuntu

WORKDIR /app

RUN apt-get update && apt-get install -y \
software-properties-common
RUN add-apt-repository universe
RUN apt-get update && apt-get install -y \
python3.6 \
python3-pip
COPY . /app

RUN pip install -r requirements.txt

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ a CLI program to download videos in a m3u8 playlist, write it to a single video
- Visit https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment for instructions on how to use virtualenv.

## Usage

### Setup without docker
- clone the repository using `git clone "ssh/https url"`.
- create a virtual environment using `virtualenv -p python3.6 venv` in linux terminal, see 'Dependencies' for platform specific instructions.
- activate virtual environment using `source venv/bin/activate` in linux terminal, see 'Dependencies' for platform specific instructions.
Expand All @@ -26,6 +28,11 @@ a CLI program to download videos in a m3u8 playlist, write it to a single video
- insert the url request headers in headers.txt.
- start the script using `python -m m3u8dl <url of playlist>`.

### Setup with docker
- build docker image using `docker build -t m3u8dl:0.11 .`
- start container `docker run -d -it --entrypoint='bash' --name m3u8dl-app m3u8dl:0.11`
- go into container terminal `docker exec -it m3u8dl-app bash`

## Installing/Uninstalling
for installation and usage using pip:-
- ensure ffmpeg is installed see dependecies section
Expand Down
23 changes: 0 additions & 23 deletions m3u8dl/core/utils/write_file_no_gil.pyx

This file was deleted.

8 changes: 6 additions & 2 deletions m3u8dl/core/weblib/fetch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from urllib.parse import urlparse
from typing import Optional

import write_file_no_gil
import requests


Expand Down Expand Up @@ -43,10 +42,15 @@ def fetch_data(download_url: str, session: requests.Session,
if request_data.status_code == 302:
request_data = redirect_handler(session, request_data)

file = open(file_path, "ab")

for chunk in request_data.iter_content(10485760):
if not chunk:
break
write_file_no_gil.write_file(file_path, chunk)

file.write(chunk)

file.close()

except (ConnectionResetError, ConnectionRefusedError, ConnectionError,
TimeoutError, ConnectionAbortedError, OSError):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
hyper==0.7.0
PyInstaller==3.6
requests==2.24.0
Cython~=0.29.21
progress~=1.5
15 changes: 0 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
from setuptools import setup, find_packages, Extension
import os

USE_CYTHON = False

ext = '.pyx' if USE_CYTHON else '.c'

path = os.path.join("m3u8dl", "core", "utils", "write_file_no_gil")
extensions = [Extension("write_file_no_gil", [path + ext])]

if USE_CYTHON:
from Cython.Build import cythonize
extensions = cythonize(extensions)


DESCRIPTION = 'm3u8 playlist downloader'
VERSION = "0.1.1"
Expand All @@ -23,7 +10,6 @@
setup(
name="m3u8dl",
version=VERSION,
ext_modules=extensions,
zip_safe=False,
author="Kevin Rohan Vaz",
author_email="excalibur.krv@gmail.com",
Expand All @@ -38,7 +24,6 @@
"hyper==0.7.0",
"PyInstaller==3.6",
"requests==2.24.0",
"Cython~=0.29.21",
"progress~=1.5"
],
classifiers=[
Expand Down

0 comments on commit 1b52e9c

Please sign in to comment.