From bc94b86fc3ae4ce224b519343ba511949b2e7ef7 Mon Sep 17 00:00:00 2001 From: Lovi <62809003+Lovi-0@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:17:06 +0100 Subject: [PATCH] Scusa @fede, re add docker, fix timeout --- Makefile | 5 + README.md | 34 +++ .../Api/Player/Helper/Vixcloud/js_parser.py | 0 .../Api/Player/Helper/Vixcloud/util.py | 0 .../{Src => }/Api/Player/ddl.py | 6 +- .../{Src => }/Api/Player/maxstream.py | 4 +- .../{Src => }/Api/Player/supervideo.py | 4 +- .../{Src => }/Api/Player/vixcloud.py | 6 +- .../{Src => }/Api/Site/1337xx/__init__.py | 2 +- .../{Src => }/Api/Site/1337xx/costant.py | 2 +- .../{Src => }/Api/Site/1337xx/site.py | 14 +- .../{Src => }/Api/Site/1337xx/title.py | 12 +- .../Api/Site/altadefinizione/__init__.py | 2 +- .../Api/Site/altadefinizione/costant.py | 2 +- .../Api/Site/altadefinizione/film.py | 16 +- .../Api/Site/altadefinizione/site.py | 14 +- .../{Src => }/Api/Site/animeunity/__init__.py | 2 +- .../{Src => }/Api/Site/animeunity/anime.py | 14 +- .../{Src => }/Api/Site/animeunity/costant.py | 2 +- .../Api/Site/animeunity/film_serie.py | 14 +- .../{Src => }/Api/Site/animeunity/site.py | 12 +- .../Api/Site/animeunity/util/ScrapeSerie.py | 6 +- .../{Src => }/Api/Site/bitsearch/__init__.py | 2 +- .../{Src => }/Api/Site/bitsearch/costant.py | 2 +- .../{Src => }/Api/Site/bitsearch/site.py | 14 +- .../{Src => }/Api/Site/bitsearch/title.py | 10 +- .../{Src => }/Api/Site/cb01new/__init__.py | 2 +- .../{Src => }/Api/Site/cb01new/costant.py | 2 +- .../{Src => }/Api/Site/cb01new/film.py | 16 +- .../{Src => }/Api/Site/cb01new/site.py | 12 +- .../Site/ddlstreamitaly/Player/ScrapeSerie.py | 8 +- .../Api/Site/ddlstreamitaly/__init__.py | 2 +- .../Api/Site/ddlstreamitaly/costant.py | 2 +- .../Api/Site/ddlstreamitaly/series.py | 16 +- .../{Src => }/Api/Site/ddlstreamitaly/site.py | 14 +- .../Site/ddlstreamitaly/util/ScrapeSerie.py | 8 +- .../Site/guardaserie/Player/ScrapeSerie.py | 13 +- .../Api/Site/guardaserie/__init__.py | 2 +- .../{Src => }/Api/Site/guardaserie/costant.py | 2 +- .../{Src => }/Api/Site/guardaserie/series.py | 16 +- .../{Src => }/Api/Site/guardaserie/site.py | 14 +- .../Api/Site/guardaserie/util/ScrapeSerie.py | 4 +- .../Api/Site/mostraguarda/__init__.py | 4 +- .../Api/Site/mostraguarda/costant.py | 2 +- .../{Src => }/Api/Site/mostraguarda/film.py | 18 +- .../{Src => }/Api/Site/piratebays/__init__.py | 2 +- .../{Src => }/Api/Site/piratebays/costant.py | 2 +- .../{Src => }/Api/Site/piratebays/site.py | 12 +- .../{Src => }/Api/Site/piratebays/title.py | 10 +- .../Api/Site/streamingcommunity/__init__.py | 2 +- .../Api/Site/streamingcommunity/costant.py | 2 +- .../Api/Site/streamingcommunity/film.py | 16 +- .../Api/Site/streamingcommunity/series.py | 16 +- .../Api/Site/streamingcommunity/site.py | 14 +- .../streamingcommunity/util/ScrapeSerie.py | 6 +- .../Api/Template/Class/SearchType.py | 0 .../{Src => }/Api/Template/Util/__init__.py | 0 .../{Src => }/Api/Template/Util/get_domain.py | 6 +- .../{Src => }/Api/Template/Util/manage_ep.py | 4 +- .../Api/Template/Util/recall_search.py | 2 +- .../{Src => }/Api/Template/__init__.py | 0 .../{Src => }/Api/Template/site.py | 2 +- .../Lib/Downloader/HLS/downloader.py | 8 +- .../{Src => }/Lib/Downloader/HLS/proxyes.py | 6 +- .../{Src => }/Lib/Downloader/HLS/segments.py | 38 ++- .../Lib/Downloader/MP4/downloader.py | 10 +- .../Lib/Downloader/TOR/downloader.py | 6 +- .../{Src => }/Lib/Downloader/__init__.py | 0 .../{Src => }/Lib/Driver/driver_1.py | 2 +- .../{Src => }/Lib/FFmpeg/__init__.py | 0 .../{Src => }/Lib/FFmpeg/capture.py | 4 +- .../{Src => }/Lib/FFmpeg/command.py | 6 +- .../{Src => }/Lib/FFmpeg/util.py | 2 +- .../{Src => }/Lib/M3U8/__init__.py | 0 .../{Src => }/Lib/M3U8/decryptor.py | 2 +- .../{Src => }/Lib/M3U8/estimator.py | 6 +- .../{Src => }/Lib/M3U8/parser.py | 2 +- .../{Src => }/Lib/M3U8/url_fixer.py | 0 .../{Src => }/Lib/TMBD/__init__.py | 0 .../{Src => }/Lib/TMBD/obj_tmbd.py | 0 StreamingCommunity/{Src => }/Lib/TMBD/tmdb.py | 2 +- StreamingCommunity/{Src => }/Upload/update.py | 8 +- .../{Src => }/Upload/version.py | 0 .../{Src => }/Util/_jsonConfig.py | 0 .../{Src => }/Util/call_stack.py | 0 StreamingCommunity/{Src => }/Util/color.py | 0 StreamingCommunity/{Src => }/Util/console.py | 0 StreamingCommunity/Util/ffmpeg_installer.py | 275 ++++++++++++++++++ StreamingCommunity/{Src => }/Util/headers.py | 0 StreamingCommunity/{Src => }/Util/logger.py | 2 +- StreamingCommunity/{Src => }/Util/message.py | 4 +- StreamingCommunity/{Src => }/Util/os.py | 27 +- StreamingCommunity/{Src => }/Util/table.py | 0 StreamingCommunity/run.py | 27 +- Test/Download/HLS.py | 6 +- Test/Download/MP4.py | 6 +- Test/Download/TOR.py | 6 +- Test/Player/helper/vixcloud.py | 4 +- Test/Player/maxtream.py | 6 +- Test/Player/supervideo.py | 6 +- Test/Player/vixcloud.py | 6 +- Test/big_search.py | 8 +- config.json | 8 +- dockerfile | 20 ++ update.py | 7 +- 105 files changed, 670 insertions(+), 304 deletions(-) create mode 100644 Makefile rename StreamingCommunity/{Src => }/Api/Player/Helper/Vixcloud/js_parser.py (100%) rename StreamingCommunity/{Src => }/Api/Player/Helper/Vixcloud/util.py (100%) rename StreamingCommunity/{Src => }/Api/Player/ddl.py (91%) rename StreamingCommunity/{Src => }/Api/Player/maxstream.py (97%) rename StreamingCommunity/{Src => }/Api/Player/supervideo.py (97%) rename StreamingCommunity/{Src => }/Api/Player/vixcloud.py (97%) rename StreamingCommunity/{Src => }/Api/Site/1337xx/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/1337xx/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/1337xx/site.py (82%) rename StreamingCommunity/{Src => }/Api/Site/1337xx/title.py (80%) rename StreamingCommunity/{Src => }/Api/Site/altadefinizione/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/altadefinizione/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/altadefinizione/film.py (75%) rename StreamingCommunity/{Src => }/Api/Site/altadefinizione/site.py (83%) rename StreamingCommunity/{Src => }/Api/Site/animeunity/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/animeunity/anime.py (87%) rename StreamingCommunity/{Src => }/Api/Site/animeunity/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/animeunity/film_serie.py (88%) rename StreamingCommunity/{Src => }/Api/Site/animeunity/site.py (92%) rename StreamingCommunity/{Src => }/Api/Site/animeunity/util/ScrapeSerie.py (92%) rename StreamingCommunity/{Src => }/Api/Site/bitsearch/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/bitsearch/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/bitsearch/site.py (83%) rename StreamingCommunity/{Src => }/Api/Site/bitsearch/title.py (76%) rename StreamingCommunity/{Src => }/Api/Site/cb01new/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/cb01new/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/cb01new/film.py (76%) rename StreamingCommunity/{Src => }/Api/Site/cb01new/site.py (80%) rename StreamingCommunity/{Src => }/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py (87%) rename StreamingCommunity/{Src => }/Api/Site/ddlstreamitaly/__init__.py (95%) rename StreamingCommunity/{Src => }/Api/Site/ddlstreamitaly/costant.py (83%) rename StreamingCommunity/{Src => }/Api/Site/ddlstreamitaly/series.py (86%) rename StreamingCommunity/{Src => }/Api/Site/ddlstreamitaly/site.py (83%) rename StreamingCommunity/{Src => }/Api/Site/ddlstreamitaly/util/ScrapeSerie.py (87%) rename StreamingCommunity/{Src => }/Api/Site/guardaserie/Player/ScrapeSerie.py (91%) rename StreamingCommunity/{Src => }/Api/Site/guardaserie/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/guardaserie/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/guardaserie/series.py (90%) rename StreamingCommunity/{Src => }/Api/Site/guardaserie/site.py (81%) rename StreamingCommunity/{Src => }/Api/Site/guardaserie/util/ScrapeSerie.py (95%) rename StreamingCommunity/{Src => }/Api/Site/mostraguarda/__init__.py (88%) rename StreamingCommunity/{Src => }/Api/Site/mostraguarda/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/mostraguarda/film.py (80%) rename StreamingCommunity/{Src => }/Api/Site/piratebays/__init__.py (94%) rename StreamingCommunity/{Src => }/Api/Site/piratebays/costant.py (81%) rename StreamingCommunity/{Src => }/Api/Site/piratebays/site.py (86%) rename StreamingCommunity/{Src => }/Api/Site/piratebays/title.py (76%) rename StreamingCommunity/{Src => }/Api/Site/streamingcommunity/__init__.py (95%) rename StreamingCommunity/{Src => }/Api/Site/streamingcommunity/costant.py (80%) rename StreamingCommunity/{Src => }/Api/Site/streamingcommunity/film.py (76%) rename StreamingCommunity/{Src => }/Api/Site/streamingcommunity/series.py (91%) rename StreamingCommunity/{Src => }/Api/Site/streamingcommunity/site.py (87%) rename StreamingCommunity/{Src => }/Api/Site/streamingcommunity/util/ScrapeSerie.py (94%) rename StreamingCommunity/{Src => }/Api/Template/Class/SearchType.py (100%) rename StreamingCommunity/{Src => }/Api/Template/Util/__init__.py (100%) rename StreamingCommunity/{Src => }/Api/Template/Util/get_domain.py (95%) rename StreamingCommunity/{Src => }/Api/Template/Util/manage_ep.py (97%) rename StreamingCommunity/{Src => }/Api/Template/Util/recall_search.py (93%) rename StreamingCommunity/{Src => }/Api/Template/__init__.py (100%) rename StreamingCommunity/{Src => }/Api/Template/site.py (98%) rename StreamingCommunity/{Src => }/Lib/Downloader/HLS/downloader.py (99%) rename StreamingCommunity/{Src => }/Lib/Downloader/HLS/proxyes.py (94%) rename StreamingCommunity/{Src => }/Lib/Downloader/HLS/segments.py (95%) rename StreamingCommunity/{Src => }/Lib/Downloader/MP4/downloader.py (94%) rename StreamingCommunity/{Src => }/Lib/Downloader/TOR/downloader.py (97%) rename StreamingCommunity/{Src => }/Lib/Downloader/__init__.py (100%) rename StreamingCommunity/{Src => }/Lib/Driver/driver_1.py (96%) rename StreamingCommunity/{Src => }/Lib/FFmpeg/__init__.py (100%) rename StreamingCommunity/{Src => }/Lib/FFmpeg/capture.py (97%) rename StreamingCommunity/{Src => }/Lib/FFmpeg/command.py (98%) rename StreamingCommunity/{Src => }/Lib/FFmpeg/util.py (99%) rename StreamingCommunity/{Src => }/Lib/M3U8/__init__.py (100%) rename StreamingCommunity/{Src => }/Lib/M3U8/decryptor.py (98%) rename StreamingCommunity/{Src => }/Lib/M3U8/estimator.py (97%) rename StreamingCommunity/{Src => }/Lib/M3U8/parser.py (99%) rename StreamingCommunity/{Src => }/Lib/M3U8/url_fixer.py (100%) rename StreamingCommunity/{Src => }/Lib/TMBD/__init__.py (100%) rename StreamingCommunity/{Src => }/Lib/TMBD/obj_tmbd.py (100%) rename StreamingCommunity/{Src => }/Lib/TMBD/tmdb.py (99%) rename StreamingCommunity/{Src => }/Upload/update.py (89%) rename StreamingCommunity/{Src => }/Upload/version.py (100%) rename StreamingCommunity/{Src => }/Util/_jsonConfig.py (100%) rename StreamingCommunity/{Src => }/Util/call_stack.py (100%) rename StreamingCommunity/{Src => }/Util/color.py (100%) rename StreamingCommunity/{Src => }/Util/console.py (100%) create mode 100644 StreamingCommunity/Util/ffmpeg_installer.py rename StreamingCommunity/{Src => }/Util/headers.py (100%) rename StreamingCommunity/{Src => }/Util/logger.py (96%) rename StreamingCommunity/{Src => }/Util/message.py (92%) rename StreamingCommunity/{Src => }/Util/os.py (95%) rename StreamingCommunity/{Src => }/Util/table.py (100%) create mode 100644 dockerfile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..acc4a1d --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +build-container: + docker build -t streaming-community-api . + +run-container: + docker run --rm -it -p 8000:8000 -v ${LOCAL_DIR}:/app/Video -v ./config.json:/app/config.json streaming-community-api \ No newline at end of file diff --git a/README.md b/README.md index 9d8dbc6..25f0ad1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Chat, contribute, and have fun in our **Git_StreamingCommunity** Discord [Server - [Win 7](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Installation#win-7) - [Termux](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Termux) - [Configuration](#configuration) +- [DOCKER](#docker) - [Tutorial](#tutorial) - [To Do](#to-do) @@ -276,6 +277,39 @@ forced-ita hin - Hindi pol - Polish tur - Turkish > "specific_list_subtitles": ["ita", "eng", "spa"] > ``` +## 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 +``` + +### Docker quick setup with Make + +Inside the Makefile (install `make`) are already configured two commands to build and run the container: + +``` +make build-container + +# set your download directory as ENV variable +make LOCAL_DIR=/path/to/download run-container +``` + +The `run-container` command mounts also the `config.json` file, so any change to the configuration file is reflected immediately without having to rebuild the image. + ### M3U8_PARSER Settings ```json diff --git a/StreamingCommunity/Src/Api/Player/Helper/Vixcloud/js_parser.py b/StreamingCommunity/Api/Player/Helper/Vixcloud/js_parser.py similarity index 100% rename from StreamingCommunity/Src/Api/Player/Helper/Vixcloud/js_parser.py rename to StreamingCommunity/Api/Player/Helper/Vixcloud/js_parser.py diff --git a/StreamingCommunity/Src/Api/Player/Helper/Vixcloud/util.py b/StreamingCommunity/Api/Player/Helper/Vixcloud/util.py similarity index 100% rename from StreamingCommunity/Src/Api/Player/Helper/Vixcloud/util.py rename to StreamingCommunity/Api/Player/Helper/Vixcloud/util.py diff --git a/StreamingCommunity/Src/Api/Player/ddl.py b/StreamingCommunity/Api/Player/ddl.py similarity index 91% rename from StreamingCommunity/Src/Api/Player/ddl.py rename to StreamingCommunity/Api/Player/ddl.py index 485b7b7..847e165 100644 --- a/StreamingCommunity/Src/Api/Player/ddl.py +++ b/StreamingCommunity/Api/Player/ddl.py @@ -9,12 +9,12 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers # Variable -from StreamingCommunity.Src.Api.Site.ddlstreamitaly.costant import COOKIE +from StreamingCommunity.Api.Site.ddlstreamitaly.costant import COOKIE max_timeout = config_manager.get_int("REQUESTS", "timeout") diff --git a/StreamingCommunity/Src/Api/Player/maxstream.py b/StreamingCommunity/Api/Player/maxstream.py similarity index 97% rename from StreamingCommunity/Src/Api/Player/maxstream.py rename to StreamingCommunity/Api/Player/maxstream.py index b2c1862..d05b714 100644 --- a/StreamingCommunity/Src/Api/Player/maxstream.py +++ b/StreamingCommunity/Api/Player/maxstream.py @@ -11,8 +11,8 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers # Variable diff --git a/StreamingCommunity/Src/Api/Player/supervideo.py b/StreamingCommunity/Api/Player/supervideo.py similarity index 97% rename from StreamingCommunity/Src/Api/Player/supervideo.py rename to StreamingCommunity/Api/Player/supervideo.py index b9f644f..74f803a 100644 --- a/StreamingCommunity/Src/Api/Player/supervideo.py +++ b/StreamingCommunity/Api/Player/supervideo.py @@ -11,8 +11,8 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers # Variable diff --git a/StreamingCommunity/Src/Api/Player/vixcloud.py b/StreamingCommunity/Api/Player/vixcloud.py similarity index 97% rename from StreamingCommunity/Src/Api/Player/vixcloud.py rename to StreamingCommunity/Api/Player/vixcloud.py index 09a4e64..6bc4bd8 100644 --- a/StreamingCommunity/Src/Api/Player/vixcloud.py +++ b/StreamingCommunity/Api/Player/vixcloud.py @@ -11,9 +11,9 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.console import console, Panel -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.console import console, Panel +from StreamingCommunity.Util._jsonConfig import config_manager from .Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection from .Helper.Vixcloud.js_parser import JavaScriptParser diff --git a/StreamingCommunity/Src/Api/Site/1337xx/__init__.py b/StreamingCommunity/Api/Site/1337xx/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/1337xx/__init__.py rename to StreamingCommunity/Api/Site/1337xx/__init__.py index af364c1..b3631cb 100644 --- a/StreamingCommunity/Src/Api/Site/1337xx/__init__.py +++ b/StreamingCommunity/Api/Site/1337xx/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/1337xx/costant.py b/StreamingCommunity/Api/Site/1337xx/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/1337xx/costant.py rename to StreamingCommunity/Api/Site/1337xx/costant.py index 37708e4..6299216 100644 --- a/StreamingCommunity/Src/Api/Site/1337xx/costant.py +++ b/StreamingCommunity/Api/Site/1337xx/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/1337xx/site.py b/StreamingCommunity/Api/Site/1337xx/site.py similarity index 82% rename from StreamingCommunity/Src/Api/Site/1337xx/site.py rename to StreamingCommunity/Api/Site/1337xx/site.py index e1fd33c..92f6fd4 100644 --- a/StreamingCommunity/Src/Api/Site/1337xx/site.py +++ b/StreamingCommunity/Api/Site/1337xx/site.py @@ -6,16 +6,16 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/1337xx/title.py b/StreamingCommunity/Api/Site/1337xx/title.py similarity index 80% rename from StreamingCommunity/Src/Api/Site/1337xx/title.py rename to StreamingCommunity/Api/Site/1337xx/title.py index 842febe..1af2b8f 100644 --- a/StreamingCommunity/Src/Api/Site/1337xx/title.py +++ b/StreamingCommunity/Api/Site/1337xx/title.py @@ -9,15 +9,15 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Lib.Downloader import TOR_downloader +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Lib.Downloader import TOR_downloader # Logic class -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Config diff --git a/StreamingCommunity/Src/Api/Site/altadefinizione/__init__.py b/StreamingCommunity/Api/Site/altadefinizione/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/altadefinizione/__init__.py rename to StreamingCommunity/Api/Site/altadefinizione/__init__.py index 41f4b99..a044fdb 100644 --- a/StreamingCommunity/Src/Api/Site/altadefinizione/__init__.py +++ b/StreamingCommunity/Api/Site/altadefinizione/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/altadefinizione/costant.py b/StreamingCommunity/Api/Site/altadefinizione/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/altadefinizione/costant.py rename to StreamingCommunity/Api/Site/altadefinizione/costant.py index bcfbbba..bd917e9 100644 --- a/StreamingCommunity/Src/Api/Site/altadefinizione/costant.py +++ b/StreamingCommunity/Api/Site/altadefinizione/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/altadefinizione/film.py b/StreamingCommunity/Api/Site/altadefinizione/film.py similarity index 75% rename from StreamingCommunity/Src/Api/Site/altadefinizione/film.py rename to StreamingCommunity/Api/Site/altadefinizione/film.py index 42677ec..0cbf1aa 100644 --- a/StreamingCommunity/Src/Api/Site/altadefinizione/film.py +++ b/StreamingCommunity/Api/Site/altadefinizione/film.py @@ -5,20 +5,20 @@ import time # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.call_stack import get_call_stack -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.call_stack import get_call_stack +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Logic class -from StreamingCommunity.Src.Api.Template.Util import execute_search -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import execute_search +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player -from StreamingCommunity.Src.Api.Player.supervideo import VideoSource +from StreamingCommunity.Api.Player.supervideo import VideoSource # Config diff --git a/StreamingCommunity/Src/Api/Site/altadefinizione/site.py b/StreamingCommunity/Api/Site/altadefinizione/site.py similarity index 83% rename from StreamingCommunity/Src/Api/Site/altadefinizione/site.py rename to StreamingCommunity/Api/Site/altadefinizione/site.py index 98feaad..b06ee7b 100644 --- a/StreamingCommunity/Src/Api/Site/altadefinizione/site.py +++ b/StreamingCommunity/Api/Site/altadefinizione/site.py @@ -6,16 +6,16 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/animeunity/__init__.py b/StreamingCommunity/Api/Site/animeunity/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/animeunity/__init__.py rename to StreamingCommunity/Api/Site/animeunity/__init__.py index 3e45978..4ceb359 100644 --- a/StreamingCommunity/Src/Api/Site/animeunity/__init__.py +++ b/StreamingCommunity/Api/Site/animeunity/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/animeunity/anime.py b/StreamingCommunity/Api/Site/animeunity/anime.py similarity index 87% rename from StreamingCommunity/Src/Api/Site/animeunity/anime.py rename to StreamingCommunity/Api/Site/animeunity/anime.py index 5ba1bca..d2a6361 100644 --- a/StreamingCommunity/Src/Api/Site/animeunity/anime.py +++ b/StreamingCommunity/Api/Site/animeunity/anime.py @@ -6,19 +6,19 @@ import logging # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Lib.Downloader import MP4_downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Lib.Downloader import MP4_downloader # Logic class -from StreamingCommunity.Src.Api.Template.Util import manage_selection -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import manage_selection +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player -from StreamingCommunity.Src.Api.Player.vixcloud import AnimeVideoSource as VideoSource +from StreamingCommunity.Api.Player.vixcloud import AnimeVideoSource as VideoSource # Variable diff --git a/StreamingCommunity/Src/Api/Site/animeunity/costant.py b/StreamingCommunity/Api/Site/animeunity/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/animeunity/costant.py rename to StreamingCommunity/Api/Site/animeunity/costant.py index 9002c8f..1b8f76a 100644 --- a/StreamingCommunity/Src/Api/Site/animeunity/costant.py +++ b/StreamingCommunity/Api/Site/animeunity/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/animeunity/film_serie.py b/StreamingCommunity/Api/Site/animeunity/film_serie.py similarity index 88% rename from StreamingCommunity/Src/Api/Site/animeunity/film_serie.py rename to StreamingCommunity/Api/Site/animeunity/film_serie.py index 4333f2e..86f305a 100644 --- a/StreamingCommunity/Src/Api/Site/animeunity/film_serie.py +++ b/StreamingCommunity/Api/Site/animeunity/film_serie.py @@ -6,20 +6,20 @@ import logging # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Lib.Downloader import MP4_downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Lib.Downloader import MP4_downloader # Logic class from .util.ScrapeSerie import ScrapeSerieAnime -from StreamingCommunity.Src.Api.Template.Util import manage_selection -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import manage_selection +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player -from StreamingCommunity.Src.Api.Player.vixcloud import VideoSourceAnime +from StreamingCommunity.Api.Player.vixcloud import VideoSourceAnime # Variable diff --git a/StreamingCommunity/Src/Api/Site/animeunity/site.py b/StreamingCommunity/Api/Site/animeunity/site.py similarity index 92% rename from StreamingCommunity/Src/Api/Site/animeunity/site.py rename to StreamingCommunity/Api/Site/animeunity/site.py index a11aeef..39b595b 100644 --- a/StreamingCommunity/Src/Api/Site/animeunity/site.py +++ b/StreamingCommunity/Api/Site/animeunity/site.py @@ -9,15 +9,15 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/animeunity/util/ScrapeSerie.py b/StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py similarity index 92% rename from StreamingCommunity/Src/Api/Site/animeunity/util/ScrapeSerie.py rename to StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py index c26f083..f4b411f 100644 --- a/StreamingCommunity/Src/Api/Site/animeunity/util/ScrapeSerie.py +++ b/StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py @@ -8,9 +8,9 @@ import httpx # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.util import EpisodeManager, Episode +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Api.Player.Helper.Vixcloud.util import EpisodeManager, Episode # Variable diff --git a/StreamingCommunity/Src/Api/Site/bitsearch/__init__.py b/StreamingCommunity/Api/Site/bitsearch/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/bitsearch/__init__.py rename to StreamingCommunity/Api/Site/bitsearch/__init__.py index ff6a3d6..ec43294 100644 --- a/StreamingCommunity/Src/Api/Site/bitsearch/__init__.py +++ b/StreamingCommunity/Api/Site/bitsearch/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/bitsearch/costant.py b/StreamingCommunity/Api/Site/bitsearch/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/bitsearch/costant.py rename to StreamingCommunity/Api/Site/bitsearch/costant.py index 2aa7117..d9172f8 100644 --- a/StreamingCommunity/Src/Api/Site/bitsearch/costant.py +++ b/StreamingCommunity/Api/Site/bitsearch/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/bitsearch/site.py b/StreamingCommunity/Api/Site/bitsearch/site.py similarity index 83% rename from StreamingCommunity/Src/Api/Site/bitsearch/site.py rename to StreamingCommunity/Api/Site/bitsearch/site.py index 0bb37c4..797058f 100644 --- a/StreamingCommunity/Src/Api/Site/bitsearch/site.py +++ b/StreamingCommunity/Api/Site/bitsearch/site.py @@ -6,16 +6,16 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/bitsearch/title.py b/StreamingCommunity/Api/Site/bitsearch/title.py similarity index 76% rename from StreamingCommunity/Src/Api/Site/bitsearch/title.py rename to StreamingCommunity/Api/Site/bitsearch/title.py index b9f41f6..af5556d 100644 --- a/StreamingCommunity/Src/Api/Site/bitsearch/title.py +++ b/StreamingCommunity/Api/Site/bitsearch/title.py @@ -4,14 +4,14 @@ import os # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Lib.Downloader import TOR_downloader +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Lib.Downloader import TOR_downloader # Logic class -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Config diff --git a/StreamingCommunity/Src/Api/Site/cb01new/__init__.py b/StreamingCommunity/Api/Site/cb01new/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/cb01new/__init__.py rename to StreamingCommunity/Api/Site/cb01new/__init__.py index 3d7cfb4..d927778 100644 --- a/StreamingCommunity/Src/Api/Site/cb01new/__init__.py +++ b/StreamingCommunity/Api/Site/cb01new/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/cb01new/costant.py b/StreamingCommunity/Api/Site/cb01new/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/cb01new/costant.py rename to StreamingCommunity/Api/Site/cb01new/costant.py index a72bf31..fbd7252 100644 --- a/StreamingCommunity/Src/Api/Site/cb01new/costant.py +++ b/StreamingCommunity/Api/Site/cb01new/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/cb01new/film.py b/StreamingCommunity/Api/Site/cb01new/film.py similarity index 76% rename from StreamingCommunity/Src/Api/Site/cb01new/film.py rename to StreamingCommunity/Api/Site/cb01new/film.py index 3e83f52..08e3845 100644 --- a/StreamingCommunity/Src/Api/Site/cb01new/film.py +++ b/StreamingCommunity/Api/Site/cb01new/film.py @@ -5,20 +5,20 @@ import time # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.call_stack import get_call_stack -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.call_stack import get_call_stack +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Logic class -from StreamingCommunity.Src.Api.Template.Util import execute_search -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import execute_search +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player -from StreamingCommunity.Src.Api.Player.maxstream import VideoSource +from StreamingCommunity.Api.Player.maxstream import VideoSource # Config diff --git a/StreamingCommunity/Src/Api/Site/cb01new/site.py b/StreamingCommunity/Api/Site/cb01new/site.py similarity index 80% rename from StreamingCommunity/Src/Api/Site/cb01new/site.py rename to StreamingCommunity/Api/Site/cb01new/site.py index df2c4df..68842c2 100644 --- a/StreamingCommunity/Src/Api/Site/cb01new/site.py +++ b/StreamingCommunity/Api/Site/cb01new/site.py @@ -6,15 +6,15 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py b/StreamingCommunity/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py similarity index 87% rename from StreamingCommunity/Src/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py rename to StreamingCommunity/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py index 49404f1..51babc7 100644 --- a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py @@ -11,15 +11,17 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers # Logic class -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Variable from ..costant import COOKIE +max_timeout = config_manager.get_int("REQUESTS", "timeout") class GetSerieInfo: @@ -48,7 +50,7 @@ class GetSerieInfo: """ try: - response = httpx.get(self.url + "?area=online", cookies=self.cookies, headers=self.headers, timeout=10) + response = httpx.get(self.url + "?area=online", cookies=self.cookies, headers=self.headers, timeout=max_timeout) response.raise_for_status() except: diff --git a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/__init__.py b/StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py similarity index 95% rename from StreamingCommunity/Src/Api/Site/ddlstreamitaly/__init__.py rename to StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py index efeb65b..123371e 100644 --- a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/__init__.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py @@ -5,7 +5,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/costant.py b/StreamingCommunity/Api/Site/ddlstreamitaly/costant.py similarity index 83% rename from StreamingCommunity/Src/Api/Site/ddlstreamitaly/costant.py rename to StreamingCommunity/Api/Site/ddlstreamitaly/costant.py index 339e96b..9b528dc 100644 --- a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/costant.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/series.py b/StreamingCommunity/Api/Site/ddlstreamitaly/series.py similarity index 86% rename from StreamingCommunity/Src/Api/Site/ddlstreamitaly/series.py rename to StreamingCommunity/Api/Site/ddlstreamitaly/series.py index 7eda9ea..74e09a4 100644 --- a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/series.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/series.py @@ -6,21 +6,21 @@ from urllib.parse import urlparse # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.table import TVShowManager -from StreamingCommunity.Src.Lib.Downloader import MP4_downloader +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.table import TVShowManager +from StreamingCommunity.Lib.Downloader import MP4_downloader # Logic class -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem -from StreamingCommunity.Src.Api.Template.Util import manage_selection, map_episode_title, validate_episode_selection +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_episode_selection # Player from .util.ScrapeSerie import GetSerieInfo -from StreamingCommunity.Src.Api.Player.ddl import VideoSource +from StreamingCommunity.Api.Player.ddl import VideoSource # Variable diff --git a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/site.py b/StreamingCommunity/Api/Site/ddlstreamitaly/site.py similarity index 83% rename from StreamingCommunity/Src/Api/Site/ddlstreamitaly/site.py rename to StreamingCommunity/Api/Site/ddlstreamitaly/site.py index 3a828cb..1fb38f5 100644 --- a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/site.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/site.py @@ -9,16 +9,16 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/util/ScrapeSerie.py b/StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py similarity index 87% rename from StreamingCommunity/Src/Api/Site/ddlstreamitaly/util/ScrapeSerie.py rename to StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py index 7c7abfa..a3b4ad4 100644 --- a/StreamingCommunity/Src/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py @@ -11,15 +11,17 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers # Logic class -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Variable from ..costant import COOKIE +max_timeout = config_manager.get_int("REQUESTS", "timeout") class GetSerieInfo: @@ -48,7 +50,7 @@ class GetSerieInfo: """ try: - response = httpx.get(f"{self.url}?area=online", cookies=self.cookies, headers=self.headers, timeout=10) + response = httpx.get(f"{self.url}?area=online", cookies=self.cookies, headers=self.headers, timeout=max_timeout) response.raise_for_status() except Exception as e: diff --git a/StreamingCommunity/Src/Api/Site/guardaserie/Player/ScrapeSerie.py b/StreamingCommunity/Api/Site/guardaserie/Player/ScrapeSerie.py similarity index 91% rename from StreamingCommunity/Src/Api/Site/guardaserie/Player/ScrapeSerie.py rename to StreamingCommunity/Api/Site/guardaserie/Player/ScrapeSerie.py index 83f3140..dc7a50e 100644 --- a/StreamingCommunity/Src/Api/Site/guardaserie/Player/ScrapeSerie.py +++ b/StreamingCommunity/Api/Site/guardaserie/Player/ScrapeSerie.py @@ -10,11 +10,16 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers # Logic class -from StreamingCommunity.Src.Api.Template .Class.SearchType import MediaItem +from StreamingCommunity.Api.Template .Class.SearchType import MediaItem + + +# Variable +max_timeout = config_manager.get_int("REQUESTS", "timeout") class GetSerieInfo: @@ -40,7 +45,7 @@ class GetSerieInfo: try: # Make an HTTP request to the series URL - response = httpx.get(self.url, headers=self.headers, timeout=15) + response = httpx.get(self.url, headers=self.headers, timeout=max_timeout) response.raise_for_status() # Parse HTML content of the page @@ -75,7 +80,7 @@ class GetSerieInfo: try: # Make an HTTP request to the series URL - response = httpx.get(self.url, headers=self.headers, timeout=15) + response = httpx.get(self.url, headers=self.headers, timeout=max_timeout) response.raise_for_status() # Parse HTML content of the page diff --git a/StreamingCommunity/Src/Api/Site/guardaserie/__init__.py b/StreamingCommunity/Api/Site/guardaserie/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/guardaserie/__init__.py rename to StreamingCommunity/Api/Site/guardaserie/__init__.py index c1deef7..059ccb6 100644 --- a/StreamingCommunity/Src/Api/Site/guardaserie/__init__.py +++ b/StreamingCommunity/Api/Site/guardaserie/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/guardaserie/costant.py b/StreamingCommunity/Api/Site/guardaserie/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/guardaserie/costant.py rename to StreamingCommunity/Api/Site/guardaserie/costant.py index ccd829a..a34bfe0 100644 --- a/StreamingCommunity/Src/Api/Site/guardaserie/costant.py +++ b/StreamingCommunity/Api/Site/guardaserie/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/guardaserie/series.py b/StreamingCommunity/Api/Site/guardaserie/series.py similarity index 90% rename from StreamingCommunity/Src/Api/Site/guardaserie/series.py rename to StreamingCommunity/Api/Site/guardaserie/series.py index d385401..521d710 100644 --- a/StreamingCommunity/Src/Api/Site/guardaserie/series.py +++ b/StreamingCommunity/Api/Site/guardaserie/series.py @@ -6,21 +6,21 @@ import time # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.call_stack import get_call_stack -from StreamingCommunity.Src.Util.table import TVShowManager -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.call_stack import get_call_stack +from StreamingCommunity.Util.table import TVShowManager +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Logic class -from StreamingCommunity.Src.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player from .util.ScrapeSerie import GetSerieInfo -from StreamingCommunity.Src.Api.Player.supervideo import VideoSource +from StreamingCommunity.Api.Player.supervideo import VideoSource # Variable diff --git a/StreamingCommunity/Src/Api/Site/guardaserie/site.py b/StreamingCommunity/Api/Site/guardaserie/site.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/guardaserie/site.py rename to StreamingCommunity/Api/Site/guardaserie/site.py index 873ea18..ee5da04 100644 --- a/StreamingCommunity/Src/Api/Site/guardaserie/site.py +++ b/StreamingCommunity/Api/Site/guardaserie/site.py @@ -6,16 +6,16 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/guardaserie/util/ScrapeSerie.py b/StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py similarity index 95% rename from StreamingCommunity/Src/Api/Site/guardaserie/util/ScrapeSerie.py rename to StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py index 83f3140..f7b195f 100644 --- a/StreamingCommunity/Src/Api/Site/guardaserie/util/ScrapeSerie.py +++ b/StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py @@ -10,11 +10,11 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers +from StreamingCommunity.Util.headers import get_headers # Logic class -from StreamingCommunity.Src.Api.Template .Class.SearchType import MediaItem +from StreamingCommunity.Api.Template .Class.SearchType import MediaItem class GetSerieInfo: diff --git a/StreamingCommunity/Src/Api/Site/mostraguarda/__init__.py b/StreamingCommunity/Api/Site/mostraguarda/__init__.py similarity index 88% rename from StreamingCommunity/Src/Api/Site/mostraguarda/__init__.py rename to StreamingCommunity/Api/Site/mostraguarda/__init__.py index 24b5ff3..a2f87d9 100644 --- a/StreamingCommunity/Src/Api/Site/mostraguarda/__init__.py +++ b/StreamingCommunity/Api/Site/mostraguarda/__init__.py @@ -4,11 +4,11 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class -from StreamingCommunity.Src.Lib.TMBD import tmdb, Json_film +from StreamingCommunity.Lib.TMBD import tmdb, Json_film from .film import download_film diff --git a/StreamingCommunity/Src/Api/Site/mostraguarda/costant.py b/StreamingCommunity/Api/Site/mostraguarda/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/mostraguarda/costant.py rename to StreamingCommunity/Api/Site/mostraguarda/costant.py index bcfbbba..bd917e9 100644 --- a/StreamingCommunity/Src/Api/Site/mostraguarda/costant.py +++ b/StreamingCommunity/Api/Site/mostraguarda/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/mostraguarda/film.py b/StreamingCommunity/Api/Site/mostraguarda/film.py similarity index 80% rename from StreamingCommunity/Src/Api/Site/mostraguarda/film.py rename to StreamingCommunity/Api/Site/mostraguarda/film.py index 84ba227..1615292 100644 --- a/StreamingCommunity/Src/Api/Site/mostraguarda/film.py +++ b/StreamingCommunity/Api/Site/mostraguarda/film.py @@ -12,24 +12,24 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.call_stack import get_call_stack -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.call_stack import get_call_stack +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Logic class -from StreamingCommunity.Src.Api.Template.Util import execute_search +from StreamingCommunity.Api.Template.Util import execute_search # Player -from StreamingCommunity.Src.Api.Player.supervideo import VideoSource +from StreamingCommunity.Api.Player.supervideo import VideoSource # TMBD -from StreamingCommunity.Src.Lib.TMBD import Json_film +from StreamingCommunity.Lib.TMBD import Json_film # Config diff --git a/StreamingCommunity/Src/Api/Site/piratebays/__init__.py b/StreamingCommunity/Api/Site/piratebays/__init__.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/piratebays/__init__.py rename to StreamingCommunity/Api/Site/piratebays/__init__.py index af364c1..b3631cb 100644 --- a/StreamingCommunity/Src/Api/Site/piratebays/__init__.py +++ b/StreamingCommunity/Api/Site/piratebays/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/piratebays/costant.py b/StreamingCommunity/Api/Site/piratebays/costant.py similarity index 81% rename from StreamingCommunity/Src/Api/Site/piratebays/costant.py rename to StreamingCommunity/Api/Site/piratebays/costant.py index 37708e4..6299216 100644 --- a/StreamingCommunity/Src/Api/Site/piratebays/costant.py +++ b/StreamingCommunity/Api/Site/piratebays/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/piratebays/site.py b/StreamingCommunity/Api/Site/piratebays/site.py similarity index 86% rename from StreamingCommunity/Src/Api/Site/piratebays/site.py rename to StreamingCommunity/Api/Site/piratebays/site.py index 0b30ea1..c1779c7 100644 --- a/StreamingCommunity/Src/Api/Site/piratebays/site.py +++ b/StreamingCommunity/Api/Site/piratebays/site.py @@ -6,15 +6,15 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable diff --git a/StreamingCommunity/Src/Api/Site/piratebays/title.py b/StreamingCommunity/Api/Site/piratebays/title.py similarity index 76% rename from StreamingCommunity/Src/Api/Site/piratebays/title.py rename to StreamingCommunity/Api/Site/piratebays/title.py index f1c10e6..94dd377 100644 --- a/StreamingCommunity/Src/Api/Site/piratebays/title.py +++ b/StreamingCommunity/Api/Site/piratebays/title.py @@ -5,14 +5,14 @@ import sys # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Lib.Downloader import TOR_downloader +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Lib.Downloader import TOR_downloader # Logic class -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Config diff --git a/StreamingCommunity/Src/Api/Site/streamingcommunity/__init__.py b/StreamingCommunity/Api/Site/streamingcommunity/__init__.py similarity index 95% rename from StreamingCommunity/Src/Api/Site/streamingcommunity/__init__.py rename to StreamingCommunity/Api/Site/streamingcommunity/__init__.py index e161f8a..fe9ee78 100644 --- a/StreamingCommunity/Src/Api/Site/streamingcommunity/__init__.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/__init__.py @@ -4,7 +4,7 @@ from unidecode import unidecode # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from StreamingCommunity.Util.console import console, msg # Logic class diff --git a/StreamingCommunity/Src/Api/Site/streamingcommunity/costant.py b/StreamingCommunity/Api/Site/streamingcommunity/costant.py similarity index 80% rename from StreamingCommunity/Src/Api/Site/streamingcommunity/costant.py rename to StreamingCommunity/Api/Site/streamingcommunity/costant.py index 601ec31..dafa73b 100644 --- a/StreamingCommunity/Src/Api/Site/streamingcommunity/costant.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/costant.py @@ -4,7 +4,7 @@ import os # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__))) diff --git a/StreamingCommunity/Src/Api/Site/streamingcommunity/film.py b/StreamingCommunity/Api/Site/streamingcommunity/film.py similarity index 76% rename from StreamingCommunity/Src/Api/Site/streamingcommunity/film.py rename to StreamingCommunity/Api/Site/streamingcommunity/film.py index fb13f51..003acbe 100644 --- a/StreamingCommunity/Src/Api/Site/streamingcommunity/film.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/film.py @@ -5,20 +5,20 @@ import time # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.call_stack import get_call_stack -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.call_stack import get_call_stack +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Logic class -from StreamingCommunity.Src.Api.Template.Util import execute_search -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import execute_search +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player -from StreamingCommunity.Src.Api.Player.vixcloud import VideoSource +from StreamingCommunity.Api.Player.vixcloud import VideoSource # Variable diff --git a/StreamingCommunity/Src/Api/Site/streamingcommunity/series.py b/StreamingCommunity/Api/Site/streamingcommunity/series.py similarity index 91% rename from StreamingCommunity/Src/Api/Site/streamingcommunity/series.py rename to StreamingCommunity/Api/Site/streamingcommunity/series.py index 8095c7b..d33c91a 100644 --- a/StreamingCommunity/Src/Api/Site/streamingcommunity/series.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/series.py @@ -6,21 +6,21 @@ import time # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.call_stack import get_call_stack -from StreamingCommunity.Src.Util.table import TVShowManager -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.call_stack import get_call_stack +from StreamingCommunity.Util.table import TVShowManager +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Logic class from .util.ScrapeSerie import ScrapeSerie -from StreamingCommunity.Src.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem +from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search +from StreamingCommunity.Api.Template.Class.SearchType import MediaItem # Player -from StreamingCommunity.Src.Api.Player.vixcloud import VideoSource +from StreamingCommunity.Api.Player.vixcloud import VideoSource # Variable diff --git a/StreamingCommunity/Src/Api/Site/streamingcommunity/site.py b/StreamingCommunity/Api/Site/streamingcommunity/site.py similarity index 87% rename from StreamingCommunity/Src/Api/Site/streamingcommunity/site.py rename to StreamingCommunity/Api/Site/streamingcommunity/site.py index 0bc4918..993c1e6 100644 --- a/StreamingCommunity/Src/Api/Site/streamingcommunity/site.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/site.py @@ -11,17 +11,17 @@ from bs4 import BeautifulSoup # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.table import TVShowManager # Logic class -from StreamingCommunity.Src.Api.Template import get_select_title -from StreamingCommunity.Src.Api.Template.Util import search_domain -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template import get_select_title +from StreamingCommunity.Api.Template.Util import search_domain +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Config diff --git a/StreamingCommunity/Src/Api/Site/streamingcommunity/util/ScrapeSerie.py b/StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py similarity index 94% rename from StreamingCommunity/Src/Api/Site/streamingcommunity/util/ScrapeSerie.py rename to StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py index cd96149..1f73f3e 100644 --- a/StreamingCommunity/Src/Api/Site/streamingcommunity/util/ScrapeSerie.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py @@ -8,9 +8,9 @@ import httpx # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.util import SeasonManager, EpisodeManager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Api.Player.Helper.Vixcloud.util import SeasonManager, EpisodeManager # Variable diff --git a/StreamingCommunity/Src/Api/Template/Class/SearchType.py b/StreamingCommunity/Api/Template/Class/SearchType.py similarity index 100% rename from StreamingCommunity/Src/Api/Template/Class/SearchType.py rename to StreamingCommunity/Api/Template/Class/SearchType.py diff --git a/StreamingCommunity/Src/Api/Template/Util/__init__.py b/StreamingCommunity/Api/Template/Util/__init__.py similarity index 100% rename from StreamingCommunity/Src/Api/Template/Util/__init__.py rename to StreamingCommunity/Api/Template/Util/__init__.py diff --git a/StreamingCommunity/Src/Api/Template/Util/get_domain.py b/StreamingCommunity/Api/Template/Util/get_domain.py similarity index 95% rename from StreamingCommunity/Src/Api/Template/Util/get_domain.py rename to StreamingCommunity/Api/Template/Util/get_domain.py index da41500..26f920c 100644 --- a/StreamingCommunity/Src/Api/Template/Util/get_domain.py +++ b/StreamingCommunity/Api/Template/Util/get_domain.py @@ -10,9 +10,9 @@ from googlesearch import search # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util._jsonConfig import config_manager def google_search(query): diff --git a/StreamingCommunity/Src/Api/Template/Util/manage_ep.py b/StreamingCommunity/Api/Template/Util/manage_ep.py similarity index 97% rename from StreamingCommunity/Src/Api/Template/Util/manage_ep.py rename to StreamingCommunity/Api/Template/Util/manage_ep.py index 22b0190..5fc3fb3 100644 --- a/StreamingCommunity/Src/Api/Template/Util/manage_ep.py +++ b/StreamingCommunity/Api/Template/Util/manage_ep.py @@ -5,8 +5,8 @@ from typing import List # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.os import os_manager +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.os import os_manager # Config diff --git a/StreamingCommunity/Src/Api/Template/Util/recall_search.py b/StreamingCommunity/Api/Template/Util/recall_search.py similarity index 93% rename from StreamingCommunity/Src/Api/Template/Util/recall_search.py rename to StreamingCommunity/Api/Template/Util/recall_search.py index 22945d8..e8b1f16 100644 --- a/StreamingCommunity/Src/Api/Template/Util/recall_search.py +++ b/StreamingCommunity/Api/Template/Util/recall_search.py @@ -21,7 +21,7 @@ def execute_search(info): # Attempt to import the specified function from the module try: # Construct the import statement dynamically - module_path = f"StreamingCommunity.Src.Api.Site{info['folder_base']}" + module_path = f"StreamingCommunity.Api.Site{info['folder_base']}" exec(f"from {module_path} import {info['function']}") # Call the specified function diff --git a/StreamingCommunity/Src/Api/Template/__init__.py b/StreamingCommunity/Api/Template/__init__.py similarity index 100% rename from StreamingCommunity/Src/Api/Template/__init__.py rename to StreamingCommunity/Api/Template/__init__.py diff --git a/StreamingCommunity/Src/Api/Template/site.py b/StreamingCommunity/Api/Template/site.py similarity index 98% rename from StreamingCommunity/Src/Api/Template/site.py rename to StreamingCommunity/Api/Template/site.py index dc5723d..e4121c2 100644 --- a/StreamingCommunity/Src/Api/Template/site.py +++ b/StreamingCommunity/Api/Template/site.py @@ -4,7 +4,7 @@ import sys # Internal utilities -from StreamingCommunity.Src.Util.console import console +from StreamingCommunity.Util.console import console # Variable diff --git a/StreamingCommunity/Src/Lib/Downloader/HLS/downloader.py b/StreamingCommunity/Lib/Downloader/HLS/downloader.py similarity index 99% rename from StreamingCommunity/Src/Lib/Downloader/HLS/downloader.py rename to StreamingCommunity/Lib/Downloader/HLS/downloader.py index be8d4ea..54c625b 100644 --- a/StreamingCommunity/Src/Lib/Downloader/HLS/downloader.py +++ b/StreamingCommunity/Lib/Downloader/HLS/downloader.py @@ -10,10 +10,10 @@ import httpx # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.console import console, Panel, Table -from StreamingCommunity.Src.Util.color import Colors -from StreamingCommunity.Src.Util.os import ( +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.console import console, Panel, Table +from StreamingCommunity.Util.color import Colors +from StreamingCommunity.Util.os import ( compute_sha1_hash, os_manager, internet_manager diff --git a/StreamingCommunity/Src/Lib/Downloader/HLS/proxyes.py b/StreamingCommunity/Lib/Downloader/HLS/proxyes.py similarity index 94% rename from StreamingCommunity/Src/Lib/Downloader/HLS/proxyes.py rename to StreamingCommunity/Lib/Downloader/HLS/proxyes.py index a8a1881..b0d026f 100644 --- a/StreamingCommunity/Src/Lib/Downloader/HLS/proxyes.py +++ b/StreamingCommunity/Lib/Downloader/HLS/proxyes.py @@ -11,9 +11,9 @@ import httpx # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.os import os_manager +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.os import os_manager class ProxyManager: diff --git a/StreamingCommunity/Src/Lib/Downloader/HLS/segments.py b/StreamingCommunity/Lib/Downloader/HLS/segments.py similarity index 95% rename from StreamingCommunity/Src/Lib/Downloader/HLS/segments.py rename to StreamingCommunity/Lib/Downloader/HLS/segments.py index 78caa92..47c4629 100644 --- a/StreamingCommunity/Src/Lib/Downloader/HLS/segments.py +++ b/StreamingCommunity/Lib/Downloader/HLS/segments.py @@ -19,12 +19,12 @@ from tqdm import tqdm # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util.headers import get_headers, random_headers -from StreamingCommunity.Src.Util.color import Colors -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.os import os_manager -from StreamingCommunity.Src.Util.call_stack import get_call_stack +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util.headers import get_headers, random_headers +from StreamingCommunity.Util.color import Colors +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.os import os_manager +from StreamingCommunity.Util.call_stack import get_call_stack # Logic class @@ -39,15 +39,19 @@ from .proxyes import main_test_proxy # Config TQDM_DELAY_WORKER = config_manager.get_float('M3U8_DOWNLOAD', 'tqdm_delay') TQDM_USE_LARGE_BAR = config_manager.get_int('M3U8_DOWNLOAD', 'tqdm_use_large_bar') + REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry') REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify_ssl') + THERE_IS_PROXY_LIST = os_manager.check_file("list_proxy.txt") PROXY_START_MIN = config_manager.get_float('REQUESTS', 'proxy_start_min') PROXY_START_MAX = config_manager.get_float('REQUESTS', 'proxy_start_max') + DEFAULT_VIDEO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_video_workser') DEFAULT_AUDIO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_audio_workser') + # Variable headers_index = config_manager.get_dict('REQUESTS', 'user-agent') max_timeout = config_manager.get_int("REQUESTS", "timeout") @@ -55,7 +59,7 @@ max_timeout = config_manager.get_int("REQUESTS", "timeout") class M3U8_Segments: - def __init__(self, url: str, tmp_folder: str, is_index_url: bool = True, base_timeout=1.0, max_timeout=5.0): + def __init__(self, url: str, tmp_folder: str, is_index_url: bool = True): """ Initializes the M3U8_Segments object. @@ -67,7 +71,8 @@ class M3U8_Segments: self.url = url self.tmp_folder = tmp_folder self.is_index_url = is_index_url - self.expected_real_time = None + self.expected_real_time = None + self.max_timeout = max_timeout self.tmp_file_path = os.path.join(self.tmp_folder, "0.ts") os.makedirs(self.tmp_folder, exist_ok=True) @@ -81,9 +86,8 @@ class M3U8_Segments: self.queue = PriorityQueue() self.stop_event = threading.Event() self.downloaded_segments = set() - self.base_timeout = base_timeout - self.max_timeout = max_timeout - self.current_timeout = base_timeout + self.base_timeout = 1.0 + self.current_timeout = 5.0 # Stopping self.interrupt_flag = threading.Event() @@ -219,7 +223,7 @@ class M3U8_Segments: signal.signal(signal.SIGINT, interrupt_handler) - def make_requests_stream(self, ts_url: str, index: int, progress_bar: tqdm, retries: int = 3, backoff_factor: float = 1.5) -> None: + def make_requests_stream(self, ts_url: str, index: int, progress_bar: tqdm, backoff_factor: float = 1.5) -> None: """ Downloads a TS segment and adds it to the segment queue with retry logic. @@ -230,7 +234,7 @@ class M3U8_Segments: - retries (int): The number of times to retry on failure (default is 3). - backoff_factor (float): The backoff factor for exponential backoff (default is 1.5 seconds). """ - for attempt in range(retries): + for attempt in range(REQUEST_MAX_RETRY): if self.interrupt_flag.is_set(): return @@ -308,10 +312,10 @@ class M3U8_Segments: return except Exception as e: - #logging.error(f"Attempt {attempt + 1} failed for segment {index} - '{ts_url}': {e}") + logging.info(f"Attempt {attempt + 1} failed for segment {index} - '{ts_url}': {e}") - if attempt + 1 == retries: - #logging.error(f"Final retry failed for segment {index}") + if attempt + 1 == REQUEST_MAX_RETRY: + console.log(f"[red]Final retry failed for segment: {index}") self.queue.put((index, None)) # Marker for failed segment progress_bar.update(1) break @@ -482,8 +486,10 @@ class M3U8_Segments: for index in missing_segments: if self.interrupt_flag.is_set(): break + try: self.make_requests_stream(self.segments[index], index, progress_bar) + except Exception as e: logging.error(f"Failed to retry segment {index}: {str(e)}") diff --git a/StreamingCommunity/Src/Lib/Downloader/MP4/downloader.py b/StreamingCommunity/Lib/Downloader/MP4/downloader.py similarity index 94% rename from StreamingCommunity/Src/Lib/Downloader/MP4/downloader.py rename to StreamingCommunity/Lib/Downloader/MP4/downloader.py index 3b24018..e008cd4 100644 --- a/StreamingCommunity/Src/Lib/Downloader/MP4/downloader.py +++ b/StreamingCommunity/Lib/Downloader/MP4/downloader.py @@ -13,11 +13,11 @@ from tqdm import tqdm # Internal utilities -from StreamingCommunity.Src.Util.headers import get_headers -from StreamingCommunity.Src.Util.color import Colors -from StreamingCommunity.Src.Util.console import console, Panel -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.os import internet_manager +from StreamingCommunity.Util.headers import get_headers +from StreamingCommunity.Util.color import Colors +from StreamingCommunity.Util.console import console, Panel +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.os import internet_manager # Logic class diff --git a/StreamingCommunity/Src/Lib/Downloader/TOR/downloader.py b/StreamingCommunity/Lib/Downloader/TOR/downloader.py similarity index 97% rename from StreamingCommunity/Src/Lib/Downloader/TOR/downloader.py rename to StreamingCommunity/Lib/Downloader/TOR/downloader.py index 5314788..37fecdd 100644 --- a/StreamingCommunity/Src/Lib/Downloader/TOR/downloader.py +++ b/StreamingCommunity/Lib/Downloader/TOR/downloader.py @@ -8,9 +8,9 @@ import logging # Internal utilities -from StreamingCommunity.Src.Util.color import Colors -from StreamingCommunity.Src.Util.os import internet_manager -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util.color import Colors +from StreamingCommunity.Util.os import internet_manager +from StreamingCommunity.Util._jsonConfig import config_manager # External libraries diff --git a/StreamingCommunity/Src/Lib/Downloader/__init__.py b/StreamingCommunity/Lib/Downloader/__init__.py similarity index 100% rename from StreamingCommunity/Src/Lib/Downloader/__init__.py rename to StreamingCommunity/Lib/Downloader/__init__.py diff --git a/StreamingCommunity/Src/Lib/Driver/driver_1.py b/StreamingCommunity/Lib/Driver/driver_1.py similarity index 96% rename from StreamingCommunity/Src/Lib/Driver/driver_1.py rename to StreamingCommunity/Lib/Driver/driver_1.py index 6737dbe..5a17a24 100644 --- a/StreamingCommunity/Src/Lib/Driver/driver_1.py +++ b/StreamingCommunity/Lib/Driver/driver_1.py @@ -10,7 +10,7 @@ from seleniumbase import Driver # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager # Config diff --git a/StreamingCommunity/Src/Lib/FFmpeg/__init__.py b/StreamingCommunity/Lib/FFmpeg/__init__.py similarity index 100% rename from StreamingCommunity/Src/Lib/FFmpeg/__init__.py rename to StreamingCommunity/Lib/FFmpeg/__init__.py diff --git a/StreamingCommunity/Src/Lib/FFmpeg/capture.py b/StreamingCommunity/Lib/FFmpeg/capture.py similarity index 97% rename from StreamingCommunity/Src/Lib/FFmpeg/capture.py rename to StreamingCommunity/Lib/FFmpeg/capture.py index 5d94bd5..fedc30f 100644 --- a/StreamingCommunity/Src/Lib/FFmpeg/capture.py +++ b/StreamingCommunity/Lib/FFmpeg/capture.py @@ -7,8 +7,8 @@ import subprocess # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util.os import internet_manager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util.os import internet_manager # Variable diff --git a/StreamingCommunity/Src/Lib/FFmpeg/command.py b/StreamingCommunity/Lib/FFmpeg/command.py similarity index 98% rename from StreamingCommunity/Src/Lib/FFmpeg/command.py rename to StreamingCommunity/Lib/FFmpeg/command.py index e7a8e8e..bd426cd 100644 --- a/StreamingCommunity/Src/Lib/FFmpeg/command.py +++ b/StreamingCommunity/Lib/FFmpeg/command.py @@ -8,9 +8,9 @@ from typing import List, Dict # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Util.os import os_manager, suppress_output -from StreamingCommunity.Src.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Util.os import os_manager, suppress_output +from StreamingCommunity.Util.console import console from .util import need_to_force_to_ts, check_duration_v_a from .capture import capture_ffmpeg_real_time from ..M3U8 import M3U8_Codec diff --git a/StreamingCommunity/Src/Lib/FFmpeg/util.py b/StreamingCommunity/Lib/FFmpeg/util.py similarity index 99% rename from StreamingCommunity/Src/Lib/FFmpeg/util.py rename to StreamingCommunity/Lib/FFmpeg/util.py index 2d4f25f..52db553 100644 --- a/StreamingCommunity/Src/Lib/FFmpeg/util.py +++ b/StreamingCommunity/Lib/FFmpeg/util.py @@ -9,7 +9,7 @@ from typing import Tuple # Internal utilities -from StreamingCommunity.Src.Util.console import console +from StreamingCommunity.Util.console import console def has_audio_stream(video_path: str) -> bool: diff --git a/StreamingCommunity/Src/Lib/M3U8/__init__.py b/StreamingCommunity/Lib/M3U8/__init__.py similarity index 100% rename from StreamingCommunity/Src/Lib/M3U8/__init__.py rename to StreamingCommunity/Lib/M3U8/__init__.py diff --git a/StreamingCommunity/Src/Lib/M3U8/decryptor.py b/StreamingCommunity/Lib/M3U8/decryptor.py similarity index 98% rename from StreamingCommunity/Src/Lib/M3U8/decryptor.py rename to StreamingCommunity/Lib/M3U8/decryptor.py index a8b3f5c..56741be 100644 --- a/StreamingCommunity/Src/Lib/M3U8/decryptor.py +++ b/StreamingCommunity/Lib/M3U8/decryptor.py @@ -7,7 +7,7 @@ import importlib.util # Internal utilities -from StreamingCommunity.Src.Util.console import console +from StreamingCommunity.Util.console import console # Check if Crypto module is installed diff --git a/StreamingCommunity/Src/Lib/M3U8/estimator.py b/StreamingCommunity/Lib/M3U8/estimator.py similarity index 97% rename from StreamingCommunity/Src/Lib/M3U8/estimator.py rename to StreamingCommunity/Lib/M3U8/estimator.py index b5a5fde..45cf0d4 100644 --- a/StreamingCommunity/Src/Lib/M3U8/estimator.py +++ b/StreamingCommunity/Lib/M3U8/estimator.py @@ -13,9 +13,9 @@ from tqdm import tqdm # Internal utilities -from StreamingCommunity.Src.Util.color import Colors -from StreamingCommunity.Src.Util.os import internet_manager -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util.color import Colors +from StreamingCommunity.Util.os import internet_manager +from StreamingCommunity.Util._jsonConfig import config_manager # Variable diff --git a/StreamingCommunity/Src/Lib/M3U8/parser.py b/StreamingCommunity/Lib/M3U8/parser.py similarity index 99% rename from StreamingCommunity/Src/Lib/M3U8/parser.py rename to StreamingCommunity/Lib/M3U8/parser.py index 06224c4..d7dd472 100644 --- a/StreamingCommunity/Src/Lib/M3U8/parser.py +++ b/StreamingCommunity/Lib/M3U8/parser.py @@ -6,7 +6,7 @@ import logging # Internal utilities from m3u8 import loads -from StreamingCommunity.Src.Util.os import internet_manager +from StreamingCommunity.Util.os import internet_manager # External libraries diff --git a/StreamingCommunity/Src/Lib/M3U8/url_fixer.py b/StreamingCommunity/Lib/M3U8/url_fixer.py similarity index 100% rename from StreamingCommunity/Src/Lib/M3U8/url_fixer.py rename to StreamingCommunity/Lib/M3U8/url_fixer.py diff --git a/StreamingCommunity/Src/Lib/TMBD/__init__.py b/StreamingCommunity/Lib/TMBD/__init__.py similarity index 100% rename from StreamingCommunity/Src/Lib/TMBD/__init__.py rename to StreamingCommunity/Lib/TMBD/__init__.py diff --git a/StreamingCommunity/Src/Lib/TMBD/obj_tmbd.py b/StreamingCommunity/Lib/TMBD/obj_tmbd.py similarity index 100% rename from StreamingCommunity/Src/Lib/TMBD/obj_tmbd.py rename to StreamingCommunity/Lib/TMBD/obj_tmbd.py diff --git a/StreamingCommunity/Src/Lib/TMBD/tmdb.py b/StreamingCommunity/Lib/TMBD/tmdb.py similarity index 99% rename from StreamingCommunity/Src/Lib/TMBD/tmdb.py rename to StreamingCommunity/Lib/TMBD/tmdb.py index dbd4af4..271bcc3 100644 --- a/StreamingCommunity/Src/Lib/TMBD/tmdb.py +++ b/StreamingCommunity/Lib/TMBD/tmdb.py @@ -11,7 +11,7 @@ from rich.console import Console # Internal utilities from .obj_tmbd import Json_film -from StreamingCommunity.Src.Util.table import TVShowManager +from StreamingCommunity.Util.table import TVShowManager # Variable diff --git a/StreamingCommunity/Src/Upload/update.py b/StreamingCommunity/Upload/update.py similarity index 89% rename from StreamingCommunity/Src/Upload/update.py rename to StreamingCommunity/Upload/update.py index cc607c7..d84ce56 100644 --- a/StreamingCommunity/Src/Upload/update.py +++ b/StreamingCommunity/Upload/update.py @@ -1,12 +1,13 @@ # 01.03.2023 import os +import sys import time # Internal utilities from .version import __version__, __author__, __title__ -from StreamingCommunity.Src.Util.console import console +from StreamingCommunity.Util.console import console # External library @@ -14,7 +15,10 @@ import httpx # Variable -main = os.path.abspath(os.path.dirname(__file__)) +if getattr(sys, 'frozen', False): # Modalità PyInstaller + base_path = os.path.join(sys._MEIPASS, "StreamingCommunity") +else: + base_path = os.path.dirname(__file__) def update(): diff --git a/StreamingCommunity/Src/Upload/version.py b/StreamingCommunity/Upload/version.py similarity index 100% rename from StreamingCommunity/Src/Upload/version.py rename to StreamingCommunity/Upload/version.py diff --git a/StreamingCommunity/Src/Util/_jsonConfig.py b/StreamingCommunity/Util/_jsonConfig.py similarity index 100% rename from StreamingCommunity/Src/Util/_jsonConfig.py rename to StreamingCommunity/Util/_jsonConfig.py diff --git a/StreamingCommunity/Src/Util/call_stack.py b/StreamingCommunity/Util/call_stack.py similarity index 100% rename from StreamingCommunity/Src/Util/call_stack.py rename to StreamingCommunity/Util/call_stack.py diff --git a/StreamingCommunity/Src/Util/color.py b/StreamingCommunity/Util/color.py similarity index 100% rename from StreamingCommunity/Src/Util/color.py rename to StreamingCommunity/Util/color.py diff --git a/StreamingCommunity/Src/Util/console.py b/StreamingCommunity/Util/console.py similarity index 100% rename from StreamingCommunity/Src/Util/console.py rename to StreamingCommunity/Util/console.py diff --git a/StreamingCommunity/Util/ffmpeg_installer.py b/StreamingCommunity/Util/ffmpeg_installer.py new file mode 100644 index 0000000..b4fa9d2 --- /dev/null +++ b/StreamingCommunity/Util/ffmpeg_installer.py @@ -0,0 +1,275 @@ +# 24.01.2024 + +import os +import platform +import subprocess +import zipfile +import tarfile +import logging +import requests +import shutil +import glob +from typing import Optional, Tuple + +# External library +from rich.console import Console +from rich.progress import Progress, SpinnerColumn, BarColumn, TextColumn, TimeRemainingColumn + + +# Variable +console = Console() + +FFMPEG_CONFIGURATION = { + 'windows': { + 'base_dir': lambda home: os.path.join(os.path.splitdrive(home)[0] + os.path.sep, 'binary'), + 'download_url': 'https://github.com/GyanD/codexffmpeg/releases/download/{version}/ffmpeg-{version}-full_build.zip', + 'file_extension': '.zip', + 'executables': ['ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe'] + }, + 'darwin': { + 'base_dir': lambda home: os.path.join(home, 'Applications', 'binary'), + 'download_url': 'https://evermeet.cx/ffmpeg/ffmpeg-{version}.zip', + 'file_extension': '.zip', + 'executables': ['ffmpeg', 'ffprobe', 'ffplay'] + }, + 'linux': { + 'base_dir': lambda home: os.path.join(home, '.local', 'bin', 'binary'), + 'download_url': 'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-{arch}-static.tar.xz', + 'file_extension': '.tar.xz', + 'executables': ['ffmpeg', 'ffprobe', 'ffplay'] + } +} + + + +class FFMPEGDownloader: + def __init__(self): + self.os_name = self._detect_system() + self.arch = self._detect_arch() + self.home_dir = os.path.expanduser('~') + self.base_dir = self._get_base_directory() + + def _detect_system(self) -> str: + """Detect and normalize operating system name.""" + system = platform.system().lower() + + if system in FFMPEG_CONFIGURATION: + return system + + raise ValueError(f"Unsupported operating system: {system}") + + def _detect_arch(self) -> str: + """ + Detect system architecture + """ + machine = platform.machine().lower() + + arch_map = { + 'amd64': 'x86_64', + 'x86_64': 'x86_64', + 'x64': 'x86_64', + 'arm64': 'arm64', + 'aarch64': 'arm64' + } + + return arch_map.get(machine, machine) + + def _get_base_directory(self) -> str: + """ + Get base directory for binaries + """ + base_dir = FFMPEG_CONFIGURATION[self.os_name]['base_dir'](self.home_dir) + os.makedirs(base_dir, exist_ok=True) + + return base_dir + + def _check_existing_binaries(self) -> Tuple[Optional[str], Optional[str]]: + """ + Check if FFmpeg binaries already exist in the base directory + """ + config = FFMPEG_CONFIGURATION[self.os_name] + executables = config['executables'] + + found_executables = [] + for executable in executables: + + # Search for exact executable in base directory + exe_paths = glob.glob(os.path.join(self.base_dir, executable)) + if exe_paths: + found_executables.append(exe_paths[0]) + + # Return paths if both executables are found + if len(found_executables) == len(executables): + return tuple(found_executables) + + return None, None + + def _get_latest_version(self) -> str: + """ + Get the latest FFmpeg version + """ + try: + version_url = 'https://www.gyan.dev/ffmpeg/builds/release-version' + return requests.get(version_url).text.strip() + + except Exception as e: + logging.error(f"Unable to get version: {e}") + return None + + def _download_file(self, url: str, destination: str) -> bool: + """ + Download with Rich progress bar + """ + try: + response = requests.get(url, stream=True) + response.raise_for_status() + + total_size = int(response.headers.get('content-length', 0)) + + with open(destination, 'wb') as file, \ + Progress( + SpinnerColumn(), + TextColumn("[progress.description]{task.description}"), + BarColumn(), + TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), + TimeRemainingColumn() + ) as progress: + + download_task = progress.add_task("[green]Downloading FFmpeg", total=total_size) + + for chunk in response.iter_content(chunk_size=8192): + size = file.write(chunk) + progress.update(download_task, advance=size) + + return True + + except Exception as e: + logging.error(f"Download error: {e}") + return False + + def _extract_and_copy_binaries(self, archive_path: str) -> Tuple[Optional[str], Optional[str]]: + """ + Extract archive and copy executables to base directory + """ + try: + # Temporary extraction path + extraction_path = os.path.join(self.base_dir, 'temp_extract') + os.makedirs(extraction_path, exist_ok=True) + + # Extract based on file type + if archive_path.endswith('.zip'): + with zipfile.ZipFile(archive_path, 'r') as zip_ref: + zip_ref.extractall(extraction_path) + elif archive_path.endswith('.tar.xz'): + import lzma + with lzma.open(archive_path, 'rb') as xz_file: + with tarfile.open(fileobj=xz_file) as tar_ref: + tar_ref.extractall(extraction_path) + + # Find and copy executables + config = FFMPEG_CONFIGURATION[self.os_name] + executables = config['executables'] + + found_paths = [] + for executable in executables: + # Find executable in extracted files + exe_paths = glob.glob(os.path.join(extraction_path, '**', executable), recursive=True) + + if exe_paths: + # Copy to base directory + dest_path = os.path.join(self.base_dir, executable) + shutil.copy2(exe_paths[0], dest_path) + + # Set execution permissions for Unix-like systems + if self.os_name != 'windows': + os.chmod(dest_path, 0o755) + + found_paths.append(dest_path) + + # Clean up temporary extraction directory + shutil.rmtree(extraction_path, ignore_errors=True) + + # Remove downloaded archive + os.remove(archive_path) + + # Return paths if both executables found + if len(found_paths) == len(executables): + return tuple(found_paths) + + return None, None + + except Exception as e: + logging.error(f"Extraction/copy error: {e}") + return None, None + + def download(self) -> Tuple[Optional[str], Optional[str]]: + """ + Main download procedure + Returns paths of ffmpeg and ffprobe + """ + # First, check if binaries already exist in base directory + existing_ffmpeg, existing_ffprobe = self._check_existing_binaries() + if existing_ffmpeg and existing_ffprobe: + return existing_ffmpeg, existing_ffprobe + + # Get latest version + version = self._get_latest_version() + if not version: + logging.error("Cannot proceed: version not found") + return None, None + + # Prepare configurations + config = FFMPEG_CONFIGURATION[self.os_name] + + # Build download URL + download_url = config['download_url'].format( + version=version, + arch=self.arch + ) + + # Download path + download_path = os.path.join( + self.base_dir, + f'ffmpeg-{version}{config["file_extension"]}' + ) + + # Download + console.print( + f"[bold blue]Downloading FFmpeg from:[/] {download_url}", + ) + if not self._download_file(download_url, download_path): + return None, None + + # Extract and copy binaries + ffmpeg_path, ffprobe_path = self._extract_and_copy_binaries(download_path) + + if ffmpeg_path and ffprobe_path: + return ffmpeg_path, ffprobe_path + + logging.error("FFmpeg executables not found") + return None, None + + +def check_ffmpeg(): + try: + # First, use 'where' command to check existing binaries on Windows + if platform.system().lower() == 'windows': + ffmpeg_path = subprocess.check_output(['where', 'ffmpeg'], text=True).strip().split('\n')[0] if subprocess.call(['where', 'ffmpeg'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0 else None + ffprobe_path = subprocess.check_output(['where', 'ffprobe'], text=True).strip().split('\n')[0] if subprocess.call(['where', 'ffprobe'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0 else None + + if ffmpeg_path and ffprobe_path: + return ffmpeg_path, ffprobe_path + + # Fallback to which/shutil method for Unix-like systems + ffmpeg_path = shutil.which('ffmpeg') + ffprobe_path = shutil.which('ffprobe') + + if ffmpeg_path and ffprobe_path: + return ffmpeg_path, ffprobe_path + + downloader = FFMPEGDownloader() + return downloader.download() + + except Exception as e: + logging.error(f"Error checking FFmpeg: {e}") + return None, None diff --git a/StreamingCommunity/Src/Util/headers.py b/StreamingCommunity/Util/headers.py similarity index 100% rename from StreamingCommunity/Src/Util/headers.py rename to StreamingCommunity/Util/headers.py diff --git a/StreamingCommunity/Src/Util/logger.py b/StreamingCommunity/Util/logger.py similarity index 96% rename from StreamingCommunity/Src/Util/logger.py rename to StreamingCommunity/Util/logger.py index 6e00851..0e5f3d0 100644 --- a/StreamingCommunity/Src/Util/logger.py +++ b/StreamingCommunity/Util/logger.py @@ -5,7 +5,7 @@ from logging.handlers import RotatingFileHandler # Internal utilities -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util._jsonConfig import config_manager class Logger: diff --git a/StreamingCommunity/Src/Util/message.py b/StreamingCommunity/Util/message.py similarity index 92% rename from StreamingCommunity/Src/Util/message.py rename to StreamingCommunity/Util/message.py index bcaab12..8a7144f 100644 --- a/StreamingCommunity/Src/Util/message.py +++ b/StreamingCommunity/Util/message.py @@ -5,8 +5,8 @@ import platform # Internal utilities -from StreamingCommunity.Src.Util.console import console -from StreamingCommunity.Src.Util._jsonConfig import config_manager +from StreamingCommunity.Util.console import console +from StreamingCommunity.Util._jsonConfig import config_manager # Variable diff --git a/StreamingCommunity/Src/Util/os.py b/StreamingCommunity/Util/os.py similarity index 95% rename from StreamingCommunity/Src/Util/os.py rename to StreamingCommunity/Util/os.py index fff6728..e923495 100644 --- a/StreamingCommunity/Src/Util/os.py +++ b/StreamingCommunity/Util/os.py @@ -3,19 +3,17 @@ import io import os import sys -import ssl import time import shutil import hashlib import logging import platform import unidecode -import importlib import subprocess import contextlib import pathvalidate import urllib.request -import importlib.metadata +import pkg_resources # External library @@ -23,7 +21,8 @@ import httpx # Internal utilities -from StreamingCommunity.Src.Util.console import console, msg +from .ffmpeg_installer import check_ffmpeg +from StreamingCommunity.Util.console import console, msg # Variable @@ -331,18 +330,23 @@ class OsSummary(): def get_library_version(self, lib_name: str): """ Retrieve the version of a Python library. - + Args: lib_name (str): The name of the Python library. - + Returns: str: The library name followed by its version, or `-not installed` if not found. """ try: - version = importlib.metadata.version(lib_name) + version = pkg_resources.get_distribution(lib_name).version return f"{lib_name}-{version}" - except importlib.metadata.PackageNotFoundError: + except pkg_resources.DistributionNotFound as e: + logging.error(f"Error with get_library_version (1): {e}") + return f"{lib_name}-not installed" + + except Exception as e: + logging.error(f"Error with get_library_version (2): {e}") return f"{lib_name}-not installed" async def download_requirements(self, url: str, filename: str): @@ -429,11 +433,13 @@ class OsSummary(): logging.info(f"Python: {python_version} ({python_implementation} {arch}) - {os_info} ({glibc_version})") # ffmpeg and ffprobe versions + ffmpeg_path, ffprobe_path = check_ffmpeg() + ffmpeg_version = self.get_executable_version(['ffmpeg', '-version']) ffprobe_version = self.get_executable_version(['ffprobe', '-version']) + console.print(f"[cyan]Path[white]: [red]ffmpeg [bold yellow]'{ffmpeg_path}'[/bold yellow][white], [red]ffprobe '[bold yellow]{ffprobe_path}'[/bold yellow]") console.print(f"[cyan]Exe versions[white]: [bold red]ffmpeg {ffmpeg_version}, ffprobe {ffprobe_version}[/bold red]") - logging.info(f"Dependencies: ffmpeg {ffmpeg_version}, ffprobe {ffprobe_version}") # Check if requirements.txt exists, if not download it requirements_file = 'requirements.txt' @@ -449,12 +455,15 @@ class OsSummary(): # Check if libraries are installed and prompt to install missing ones for lib in optional_libraries: installed_version = self.get_library_version(lib) + if 'not installed' in installed_version: + # Prompt user to install missing library using Prompt.ask() user_response = msg.ask(f"{lib} is not installed. Do you want to install it? (yes/no)", default="y") if user_response.lower().strip() in ["yes", "y"]: self.install_library(lib) + else: #console.print(f"[cyan]Library[white]: [bold red]{installed_version}[/bold red]") logging.info(f"Library: {installed_version}") diff --git a/StreamingCommunity/Src/Util/table.py b/StreamingCommunity/Util/table.py similarity index 100% rename from StreamingCommunity/Src/Util/table.py rename to StreamingCommunity/Util/table.py diff --git a/StreamingCommunity/run.py b/StreamingCommunity/run.py index 89a5b86..df9a1b5 100644 --- a/StreamingCommunity/run.py +++ b/StreamingCommunity/run.py @@ -13,13 +13,13 @@ from typing import Callable # Internal utilities -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.console import console, msg -from StreamingCommunity.Src.Util._jsonConfig import config_manager -from StreamingCommunity.Src.Upload.update import update as git_update -from StreamingCommunity.Src.Util.os import OsSummary -from StreamingCommunity.Src.Lib.TMBD import tmdb -from StreamingCommunity.Src.Util.logger import Logger +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.Util._jsonConfig import config_manager +from StreamingCommunity.Upload.update import update as git_update +from StreamingCommunity.Util.os import OsSummary +from StreamingCommunity.Lib.TMBD import tmdb +from StreamingCommunity.Util.logger import Logger # Config @@ -46,8 +46,13 @@ def load_search_functions(): modules = [] loaded_functions = {} - # Traverse the Api directory - api_dir = os.path.join(os.path.dirname(__file__), 'Src', 'Api', 'Site') + # Find api home directory + if getattr(sys, 'frozen', False): # Modalità PyInstaller + base_path = os.path.join(sys._MEIPASS, "StreamingCommunity") + else: + base_path = os.path.dirname(__file__) + + api_dir = os.path.join(base_path, 'Api', 'Site') init_files = glob.glob(os.path.join(api_dir, '*', '__init__.py')) # Retrieve modules and their indices @@ -59,7 +64,7 @@ def load_search_functions(): try: # Dynamically import the module - mod = importlib.import_module(f'StreamingCommunity.Src.Api.Site.{module_name}') + mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}') # Get 'indice' from the module indice = getattr(mod, 'indice', 0) @@ -84,7 +89,7 @@ def load_search_functions(): try: # Dynamically import the module - mod = importlib.import_module(f'StreamingCommunity.Src.Api.Site.{module_name}') + mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}') # Get the search function from the module (assuming the function is named 'search' and defined in __init__.py) search_function = getattr(mod, 'search') diff --git a/Test/Download/HLS.py b/Test/Download/HLS.py index bee553e..5601d95 100644 --- a/Test/Download/HLS.py +++ b/Test/Download/HLS.py @@ -9,9 +9,9 @@ sys.path.append(src_path) # Import -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.logger import Logger -from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.logger import Logger +from StreamingCommunity.Lib.Downloader import HLS_Downloader # Test diff --git a/Test/Download/MP4.py b/Test/Download/MP4.py index 262e5f8..ecb125b 100644 --- a/Test/Download/MP4.py +++ b/Test/Download/MP4.py @@ -9,9 +9,9 @@ sys.path.append(src_path) # Import -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.logger import Logger -from StreamingCommunity.Src.Lib.Downloader import MP4_downloader +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.logger import Logger +from StreamingCommunity.Lib.Downloader import MP4_downloader # Test diff --git a/Test/Download/TOR.py b/Test/Download/TOR.py index dc27e89..a822e1b 100644 --- a/Test/Download/TOR.py +++ b/Test/Download/TOR.py @@ -9,9 +9,9 @@ sys.path.append(src_path) # Import -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.logger import Logger -from StreamingCommunity.Src.Lib.Downloader import TOR_downloader +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.logger import Logger +from StreamingCommunity.Lib.Downloader import TOR_downloader # Test diff --git a/Test/Player/helper/vixcloud.py b/Test/Player/helper/vixcloud.py index ec7ff60..3c1cf78 100644 --- a/Test/Player/helper/vixcloud.py +++ b/Test/Player/helper/vixcloud.py @@ -7,8 +7,8 @@ sys.path.append(src_path) # Import import json -from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.js_parser import JavaScriptParser -from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection +from StreamingCommunity.Api.Player.Helper.Vixcloud.js_parser import JavaScriptParser +from StreamingCommunity.Api.Player.Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection # Data diff --git a/Test/Player/maxtream.py b/Test/Player/maxtream.py index a53d901..cc529bd 100644 --- a/Test/Player/maxtream.py +++ b/Test/Player/maxtream.py @@ -9,9 +9,9 @@ sys.path.append(src_path) # Import -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.logger import Logger -from StreamingCommunity.Src.Api.Player.maxstream import VideoSource +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.logger import Logger +from StreamingCommunity.Api.Player.maxstream import VideoSource # Test diff --git a/Test/Player/supervideo.py b/Test/Player/supervideo.py index 029b4f1..301b054 100644 --- a/Test/Player/supervideo.py +++ b/Test/Player/supervideo.py @@ -9,9 +9,9 @@ sys.path.append(src_path) # Import -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.logger import Logger -from StreamingCommunity.Src.Api.Player.supervideo import VideoSource +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.logger import Logger +from StreamingCommunity.Api.Player.supervideo import VideoSource # Test diff --git a/Test/Player/vixcloud.py b/Test/Player/vixcloud.py index 270539c..2a3a88f 100644 --- a/Test/Player/vixcloud.py +++ b/Test/Player/vixcloud.py @@ -9,9 +9,9 @@ sys.path.append(src_path) # Import -from StreamingCommunity.Src.Util.message import start_message -from StreamingCommunity.Src.Util.logger import Logger -from StreamingCommunity.Src.Api.Player.vixcloud import VideoSource +from StreamingCommunity.Util.message import start_message +from StreamingCommunity.Util.logger import Logger +from StreamingCommunity.Api.Player.vixcloud import VideoSource # Test diff --git a/Test/big_search.py b/Test/big_search.py index 4323b20..86010f3 100644 --- a/Test/big_search.py +++ b/Test/big_search.py @@ -15,7 +15,7 @@ from rich.console import Console # Other import -from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager +from StreamingCommunity.Api.Template.Class.SearchType import MediaManager # Variable @@ -27,7 +27,7 @@ def load_search_functions(): loaded_functions = {} # Traverse the Api directory - api_dir = os.path.join(os.path.dirname(__file__), '..', 'StreamingCommunity', 'Src', 'Api', 'Site') + api_dir = os.path.join(os.path.dirname(__file__), '..', 'StreamingCommunity', 'Api', 'Site') init_files = glob.glob(os.path.join(api_dir, '*', '__init__.py')) logging.info(f"Base folder path: {api_dir}") @@ -42,7 +42,7 @@ def load_search_functions(): try: # Dynamically import the module - mod = importlib.import_module(f'StreamingCommunity.Src.Api.Site.{module_name}') + mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}') # Get 'indice' from the module indice = getattr(mod, 'indice', 0) @@ -67,7 +67,7 @@ def load_search_functions(): try: # Dynamically import the module - mod = importlib.import_module(f'StreamingCommunity.Src.Api.Site.{module_name}') + mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}') # Get the search function from the module (assuming the function is named 'search' and defined in __init__.py) search_function = getattr(mod, 'search') diff --git a/config.json b/config.json index cc64372..311bf21 100644 --- a/config.json +++ b/config.json @@ -18,11 +18,11 @@ }, "REQUESTS": { "timeout": 20, - "max_retry": 3, + "max_retry": 5, "verify_ssl": true, - "user-agent": "", "proxy_start_min": 0.1, - "proxy_start_max": 0.5 + "proxy_start_max": 0.5, + "user-agent": "" }, "BROWSER": { "headless": false @@ -60,8 +60,6 @@ }, "SITE": { "streamingcommunity": { - "video_workers": 7, - "audio_workers": 7, "domain": "computer" }, "altadefinizione": { diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..6ca85d0 --- /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", "test_run.py"] \ No newline at end of file diff --git a/update.py b/update.py index a7fc08f..1cb533a 100644 --- a/update.py +++ b/update.py @@ -16,9 +16,10 @@ from rich.table import Table # Variable +max_timeout = 20 console = Console() local_path = os.path.join(".") -from StreamingCommunity.Src.Upload.version import __author__, __title__ +from StreamingCommunity.Upload.version import __author__, __title__ def move_content(source: str, destination: str): @@ -125,7 +126,7 @@ def download_and_extract_latest_commit(): 'Accept': 'application/vnd.github.v3+json', 'User-Agent': f'{__title__}-updater' } - response = httpx.get(api_url, headers=headers, timeout=10) + response = httpx.get(api_url, headers=headers, timeout=max_timeout) if response.status_code == 200: commit_info = response.json()[0] @@ -138,7 +139,7 @@ def download_and_extract_latest_commit(): console.log("[green]Downloading latest commit zip file...") # Download the zipball - response = httpx.get(zipball_url, follow_redirects=True, timeout=10) + response = httpx.get(zipball_url, follow_redirects=True, timeout=max_timeout) temp_path = os.path.join(os.path.dirname(os.getcwd()), 'temp_extracted') # Extract the content of the zipball into a temporary folder