mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 19:45:24 +00:00
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
This commit is contained in:
parent
2939da93db
commit
ddcb3dfb71
21
README.md
21
README.md
@ -15,7 +15,8 @@ You can chat, help improve this repo, or just hang around for some fun in the **
|
|||||||
* [Requirement](#requirement)
|
* [Requirement](#requirement)
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
* [Update](#update)
|
* [Update](#update)
|
||||||
* [USAGE AND OPTIONS](#options)
|
* [CONFIGURATION](#Configuration)
|
||||||
|
* [DOCKER](#docker)
|
||||||
* [TUTORIAL](#tutorial)
|
* [TUTORIAL](#tutorial)
|
||||||
|
|
||||||
## Requirement
|
## Requirement
|
||||||
@ -187,5 +188,23 @@ You can choose different vars:
|
|||||||
* `%(episode_name)` : Is the name of the episode
|
* `%(episode_name)` : Is the name of the episode
|
||||||
>NOTE: You don't need to add .mp4 at the end
|
>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
|
## Tutorial
|
||||||
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
||||||
|
@ -143,8 +143,8 @@ def test_site(domain: str) -> str:
|
|||||||
str: The response text if successful, otherwise None.
|
str: The response text if successful, otherwise None.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
console.print("[cyan]Make request site [white]...")
|
|
||||||
site_url = f"https://streamingcommunity.{domain}"
|
site_url = f"https://streamingcommunity.{domain}"
|
||||||
|
console.print(f"[cyan]Make request site to {site_url} [white]...")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(site_url, headers={'user-agent': get_headers()})
|
response = requests.get(site_url, headers={'user-agent': get_headers()})
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"SITE": {
|
"SITE": {
|
||||||
"streaming_site_name": "streamingcommunity",
|
"streaming_site_name": "streamingcommunity",
|
||||||
"streaming_domain": "forum",
|
"streaming_domain": "africa",
|
||||||
"anime_site_name": "animeunity",
|
"anime_site_name": "animeunity",
|
||||||
"anime_domain": "to"
|
"anime_domain": "to"
|
||||||
},
|
},
|
||||||
|
20
dockerfile
Normal file
20
dockerfile
Normal file
@ -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"]
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
36
run.py
36
run.py
@ -3,6 +3,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import platform
|
import platform
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
@ -168,21 +169,34 @@ def main_switch():
|
|||||||
else:
|
else:
|
||||||
console.print("[red]Cant find a single element")
|
console.print("[red]Cant find a single element")
|
||||||
|
|
||||||
|
def run_function(func, close_console=False):
|
||||||
|
if close_console:
|
||||||
|
while 1:
|
||||||
|
func()
|
||||||
|
else:
|
||||||
|
func()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
logger = Logger()
|
logger = Logger()
|
||||||
|
|
||||||
if not SWITCH_TO:
|
# Parse command line arguments
|
||||||
if not CLOSE_CONSOLE:
|
parser = argparse.ArgumentParser(description='Script to download film and series from internet.')
|
||||||
main()
|
parser.add_argument('-a', '--anime', action='store_true', help='Check into anime category')
|
||||||
else:
|
parser.add_argument('-f', '--film', action='store_true', help='Check into film/tv series category')
|
||||||
while 1:
|
args = parser.parse_args()
|
||||||
main()
|
|
||||||
|
|
||||||
|
if args.anime:
|
||||||
|
run_function(main_switch, CLOSE_CONSOLE)
|
||||||
|
elif args.film:
|
||||||
|
run_function(main, CLOSE_CONSOLE)
|
||||||
else:
|
else:
|
||||||
if not CLOSE_CONSOLE:
|
# If no arguments are provided, ask the user to input the category
|
||||||
main_switch()
|
category = input("Insert category (0: Film/series, 1: Anime) : ")
|
||||||
|
if category == '0':
|
||||||
|
run_function(main, CLOSE_CONSOLE)
|
||||||
|
elif category == '1':
|
||||||
|
run_function(main_switch, CLOSE_CONSOLE)
|
||||||
else:
|
else:
|
||||||
while 1:
|
console.print("[red]Invalid category")
|
||||||
main_switch()
|
sys.exit(0)
|
Loading…
x
Reference in New Issue
Block a user