From ddcb3dfb7102eb238be801e6aaaa6aecb7f44bef Mon Sep 17 00:00:00 2001 From: Francesco Grazioso <40018163+FrancescoGrazioso@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:38:34 +0200 Subject: [PATCH] create dockerization for the script (#105) * add dockerfile and change base domain to current one * add ffmpeg to dockerfile and edit README * add instructions to save media locally * fix typo * add dependencies to dockerfile * fix dependencies * add ability to switch between anime and film on run without changing config * add dependencies to dockerfile * add argparse * fix readme * fix args description --- README.md | 21 ++++++++++++++++++++- Src/Api/site.py | 2 +- config.json | 2 +- dockerfile | 20 ++++++++++++++++++++ requirements.txt | Bin 122 -> 134 bytes run.py | 36 +++++++++++++++++++++++++----------- 6 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 dockerfile diff --git a/README.md b/README.md index efafa25..a616852 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ You can chat, help improve this repo, or just hang around for some fun in the ** * [Requirement](#requirement) * [Usage](#usage) * [Update](#update) -* [USAGE AND OPTIONS](#options) +* [CONFIGURATION](#Configuration) +* [DOCKER](#docker) * [TUTORIAL](#tutorial) ## Requirement @@ -187,5 +188,23 @@ You can choose different vars: * `%(episode_name)` : Is the name of the episode >NOTE: You don't need to add .mp4 at the end +## Docker +You can run the script in a docker container, to build the image just run +``` +docker build -t streaming-community-api . +``` + +and to run it use + +``` +docker run -it -p 8000:8000 streaming-community-api +``` + +By default the videos will be saved in `/app/Video` inside the container, if you want to to save them in your machine instead of the container just run + +``` +docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api +``` + ## Tutorial For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing) diff --git a/Src/Api/site.py b/Src/Api/site.py index 27caa96..c864fca 100644 --- a/Src/Api/site.py +++ b/Src/Api/site.py @@ -143,8 +143,8 @@ def test_site(domain: str) -> str: str: The response text if successful, otherwise None. """ - console.print("[cyan]Make request site [white]...") site_url = f"https://streamingcommunity.{domain}" + console.print(f"[cyan]Make request site to {site_url} [white]...") try: response = requests.get(site_url, headers={'user-agent': get_headers()}) diff --git a/config.json b/config.json index cdf3417..99bf9ab 100644 --- a/config.json +++ b/config.json @@ -16,7 +16,7 @@ }, "SITE": { "streaming_site_name": "streamingcommunity", - "streaming_domain": "forum", + "streaming_domain": "africa", "anime_site_name": "animeunity", "anime_domain": "to" }, diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..ff5a582 --- /dev/null +++ b/dockerfile @@ -0,0 +1,20 @@ +FROM python:3.11-slim + +COPY . /app +WORKDIR /app + +ENV TEMP /tmp +RUN mkdir -p $TEMP + +RUN apt-get update && apt-get install -y \ + ffmpeg \ + build-essential \ + libssl-dev \ + libffi-dev \ + python3-dev \ + libxml2-dev \ + libxslt1-dev + +RUN pip install --no-cache-dir -r requirements.txt + +CMD ["python", "run.py"] diff --git a/requirements.txt b/requirements.txt index de6588c30cc53dc9d409ae3ac59295a27f19067a..9b91b0749be2b181cca092f3f07be6d10ab144df 100644 GIT binary patch delta 18 Xcmb