From 2ba6ae4512e7541004955ff24599baafe9f89a0e Mon Sep 17 00:00:00 2001 From: Dark1291 Date: Wed, 5 Feb 2025 09:47:20 +0100 Subject: [PATCH] Add betterer formattation and ffmpeg installation testing --- README.md | 7 +-- .../Api/Site/1337xx/__init__.py | 42 +++++++++--------- StreamingCommunity/Api/Site/1337xx/costant.py | 4 +- .../Site/altadefinizionegratis/__init__.py | 38 ++++++++-------- .../Api/Site/altadefinizionegratis/costant.py | 4 +- .../Api/Site/animeunity/__init__.py | 43 +++++++++---------- .../Api/Site/animeunity/costant.py | 4 +- .../Api/Site/streamingcommunity/__init__.py | 40 ++++++++--------- .../Api/Site/streamingcommunity/costant.py | 4 +- Test/Util/ffmpegVersion.py | 29 +++++++++++++ Test/Util/{oss.py => osPath.py} | 0 config.json | 16 +++---- requirements.txt | 6 +-- test_run.py | 1 - 14 files changed, 132 insertions(+), 106 deletions(-) create mode 100644 Test/Util/ffmpegVersion.py rename Test/Util/{oss.py => osPath.py} (100%) diff --git a/README.md b/README.md index 2a17245..a429927 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,6 @@ Windows - - PyPI - Source Tarball @@ -471,10 +468,10 @@ The `run-container` command mounts also the `config.json` file, so any change to | Website | Status | |:-------------------|:------:| | [1337xx](https://1337xx.to/) | ✅ | -| [AltadefinizioneGratis](https://altadefinizionegratis.site/) | ✅ | +| [AltadefinizioneGratis](https://altadefinizionegratis.pro/) | ✅ | | [AnimeUnity](https://animeunity.so/) | ✅ | | [Ilcorsaronero](https://ilcorsaronero.link/) | ✅ | -| [CB01New](https://cb01new.video/) | ✅ | +| [CB01New](https://cb01new.media/) | ✅ | | [DDLStreamItaly](https://ddlstreamitaly.co/) | ✅ | | [GuardaSerie](https://guardaserie.meme/) | ✅ | | [MostraGuarda](https://mostraguarda.stream/) | ✅ | diff --git a/StreamingCommunity/Api/Site/1337xx/__init__.py b/StreamingCommunity/Api/Site/1337xx/__init__.py index bad0b7c..be44d7b 100644 --- a/StreamingCommunity/Api/Site/1337xx/__init__.py +++ b/StreamingCommunity/Api/Site/1337xx/__init__.py @@ -1,22 +1,19 @@ # 02.07.24 +import sys +import subprocess from urllib.parse import quote_plus # Internal utilities from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance # Logic class from .site import title_search, run_get_select_title, media_search_manager from .title import download_title -# Telegram bot instance -from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance -from StreamingCommunity.Util._jsonConfig import config_manager -TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') -import sys -import subprocess # Variable indice = 8 @@ -24,7 +21,7 @@ _useFor = "film_serie" _deprecate = False _priority = 2 _engineDownload = "tor" -from .costant import SITE_NAME +from .costant import SITE_NAME, TELEGRAM_BOT def search(string_to_search: str = None, get_onylDatabase: bool = False): @@ -32,23 +29,24 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False): Main function of the application for film and series. """ if TELEGRAM_BOT: - bot = get_bot_instance() + bot = get_bot_instance() - # Chiedi la scelta all'utente con il bot Telegram - string_to_search = bot.ask( - "key_search", - f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", - None - ) + # Chiedi la scelta all'utente con il bot Telegram + string_to_search = bot.ask( + "key_search", + f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", + None + ) - if string_to_search == 'back': - # Riavvia lo script - # Chiude il processo attuale e avvia una nuova istanza dello script - subprocess.Popen([sys.executable] + sys.argv) - sys.exit() + if string_to_search == 'back': + # Riavvia lo script + # Chiude il processo attuale e avvia una nuova istanza dello script + subprocess.Popen([sys.executable] + sys.argv) + sys.exit() + else: - if string_to_search is None: - string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() + if string_to_search is None: + string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() # Search on database len_database = title_search(quote_plus(string_to_search)) @@ -69,4 +67,4 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False): console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}") # Retry - search() + search() \ No newline at end of file diff --git a/StreamingCommunity/Api/Site/1337xx/costant.py b/StreamingCommunity/Api/Site/1337xx/costant.py index c4bd929..a67af91 100644 --- a/StreamingCommunity/Api/Site/1337xx/costant.py +++ b/StreamingCommunity/Api/Site/1337xx/costant.py @@ -12,4 +12,6 @@ ROOT_PATH = config_manager.get('DEFAULT', 'root_path') DOMAIN_NOW = config_manager.get_dict('SITE', SITE_NAME)['domain'] SERIES_FOLDER = config_manager.get('DEFAULT', 'serie_folder_name') -MOVIE_FOLDER = config_manager.get('DEFAULT', 'movie_folder_name') \ No newline at end of file +MOVIE_FOLDER = config_manager.get('DEFAULT', 'movie_folder_name') + +TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') \ No newline at end of file diff --git a/StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py b/StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py index 40c86df..3beae00 100644 --- a/StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py +++ b/StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py @@ -1,20 +1,19 @@ # 26.05.24 +import sys +import subprocess from urllib.parse import quote_plus # Internal utilities from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance # Logic class from .site import title_search, run_get_select_title, media_search_manager from .film import download_film -# Telegram bot instance -from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance -from StreamingCommunity.Util._jsonConfig import config_manager -TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') # Variable indice = 2 @@ -22,33 +21,34 @@ _useFor = "film" _deprecate = False _priority = 2 _engineDownload = "hls" -from .costant import SITE_NAME +from .costant import SITE_NAME, TELEGRAM_BOT def search(string_to_search: str = None, get_onylDatabase: bool = False): """ Main function of the application for film and series. """ - if TELEGRAM_BOT: bot = get_bot_instance() if string_to_search is None: - # Chiedi la scelta all'utente con il bot Telegram - string_to_search = bot.ask( - "key_search", - f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", - None - ) + + # Chiedi la scelta all'utente con il bot Telegram + string_to_search = bot.ask( + "key_search", + f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", + None + ) + + if string_to_search == 'back': + # Riavvia lo script + # Chiude il processo attuale e avvia una nuova istanza dello script + subprocess.Popen([sys.executable] + sys.argv) + sys.exit() - if string_to_search == 'back': - # Riavvia lo script - # Chiude il processo attuale e avvia una nuova istanza dello script - subprocess.Popen([sys.executable] + sys.argv) - sys.exit() else: - if string_to_search is None: - string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() + if string_to_search is None: + string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() # Search on database len_database = title_search(quote_plus(string_to_search)) diff --git a/StreamingCommunity/Api/Site/altadefinizionegratis/costant.py b/StreamingCommunity/Api/Site/altadefinizionegratis/costant.py index cb76a8b..e4d4d9a 100644 --- a/StreamingCommunity/Api/Site/altadefinizionegratis/costant.py +++ b/StreamingCommunity/Api/Site/altadefinizionegratis/costant.py @@ -16,4 +16,6 @@ MOVIE_FOLDER = os.path.join(ROOT_PATH, config_manager.get('DEFAULT', 'movie_fold if config_manager.get_bool("DEFAULT", "add_siteName"): SERIES_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'serie_folder_name')) - MOVIE_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'movie_folder_name')) \ No newline at end of file + MOVIE_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'movie_folder_name')) + +TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') \ No newline at end of file diff --git a/StreamingCommunity/Api/Site/animeunity/__init__.py b/StreamingCommunity/Api/Site/animeunity/__init__.py index 6c83ca5..1503d23 100644 --- a/StreamingCommunity/Api/Site/animeunity/__init__.py +++ b/StreamingCommunity/Api/Site/animeunity/__init__.py @@ -1,23 +1,19 @@ # 21.05.24 +import sys +import subprocess from urllib.parse import quote_plus # Internal utilities from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance # Logic class from .site import title_search, run_get_select_title, media_search_manager from .film_serie import download_film, download_series -# Telegram bot instance -from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance -from StreamingCommunity.Util._jsonConfig import config_manager -TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') -import sys -import subprocess - # Variable indice = 1 @@ -25,30 +21,31 @@ _useFor = "anime" _deprecate = False _priority = 2 _engineDownload = "mp4" -from .costant import SITE_NAME +from .costant import SITE_NAME, TELEGRAM_BOT def search(string_to_search: str = None, get_onylDatabase: bool = False): if TELEGRAM_BOT: - bot = get_bot_instance() + bot = get_bot_instance() - if string_to_search is None: - # Chiedi la scelta all'utente con il bot Telegram - string_to_search = bot.ask( - "key_search", - f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", - None - ) + if string_to_search is None: + # Chiedi la scelta all'utente con il bot Telegram + string_to_search = bot.ask( + "key_search", + f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", + None + ) + + if string_to_search == 'back': + # Riavvia lo script + # Chiude il processo attuale e avvia una nuova istanza dello script + subprocess.Popen([sys.executable] + sys.argv) + sys.exit() - if string_to_search == 'back': - # Riavvia lo script - # Chiude il processo attuale e avvia una nuova istanza dello script - subprocess.Popen([sys.executable] + sys.argv) - sys.exit() else: - if string_to_search is None: - string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() + if string_to_search is None: + string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() # Search on database len_database = title_search(string_to_search) diff --git a/StreamingCommunity/Api/Site/animeunity/costant.py b/StreamingCommunity/Api/Site/animeunity/costant.py index 4bb90f8..1702282 100644 --- a/StreamingCommunity/Api/Site/animeunity/costant.py +++ b/StreamingCommunity/Api/Site/animeunity/costant.py @@ -16,4 +16,6 @@ ANIME_FOLDER = os.path.join(ROOT_PATH, config_manager.get('DEFAULT', 'anime_fold if config_manager.get_bool("DEFAULT", "add_siteName"): MOVIE_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'movie_folder_name')) - ANIME_FOLDER = os.path.join(ROOT_PATH, config_manager.get('DEFAULT', 'anime_folder_name')) \ No newline at end of file + ANIME_FOLDER = os.path.join(ROOT_PATH, config_manager.get('DEFAULT', 'anime_folder_name')) + +TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') \ No newline at end of file diff --git a/StreamingCommunity/Api/Site/streamingcommunity/__init__.py b/StreamingCommunity/Api/Site/streamingcommunity/__init__.py index a0ad193..3e778fa 100644 --- a/StreamingCommunity/Api/Site/streamingcommunity/__init__.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/__init__.py @@ -1,11 +1,13 @@ # 21.05.24 -from urllib.parse import quote_plus -import subprocess import sys +import subprocess +from urllib.parse import quote_plus + # Internal utilities from StreamingCommunity.Util.console import console, msg +from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance # Logic class @@ -13,10 +15,6 @@ from .site import get_version_and_domain, title_search, run_get_select_title, me from .film import download_film from .series import download_series -# Telegram bot instance -from StreamingCommunity.Util._jsonConfig import config_manager -from StreamingCommunity.HelpTg.telegram_bot import get_bot_instance -TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') # Variable indice = 0 @@ -24,30 +22,30 @@ _useFor = "film_serie" _deprecate = False _priority = 1 _engineDownload = "hls" -from .costant import SITE_NAME +from .costant import SITE_NAME, TELEGRAM_BOT def search(string_to_search: str = None, get_onylDatabase: bool = False): """ Main function of the application for film and series. """ - if TELEGRAM_BOT: - bot = get_bot_instance() + bot = get_bot_instance() - if string_to_search is None: - # Chiedi la scelta all'utente con il bot Telegram - string_to_search = bot.ask( - "key_search", - f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", - None - ) + if string_to_search is None: + # Chiedi la scelta all'utente con il bot Telegram + string_to_search = bot.ask( + "key_search", + f"Inserisci la parola da cercare\noppure 🔙 back per tornare alla scelta: ", + None + ) - if string_to_search == 'back': - # Riavvia lo script - # Chiude il processo attuale e avvia una nuova istanza dello script - subprocess.Popen([sys.executable] + sys.argv) - sys.exit() + if string_to_search == 'back': + # Riavvia lo script + # Chiude il processo attuale e avvia una nuova istanza dello script + subprocess.Popen([sys.executable] + sys.argv) + sys.exit() + else: if string_to_search is None: string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip() diff --git a/StreamingCommunity/Api/Site/streamingcommunity/costant.py b/StreamingCommunity/Api/Site/streamingcommunity/costant.py index cb76a8b..bb5f066 100644 --- a/StreamingCommunity/Api/Site/streamingcommunity/costant.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/costant.py @@ -16,4 +16,6 @@ MOVIE_FOLDER = os.path.join(ROOT_PATH, config_manager.get('DEFAULT', 'movie_fold if config_manager.get_bool("DEFAULT", "add_siteName"): SERIES_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'serie_folder_name')) - MOVIE_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'movie_folder_name')) \ No newline at end of file + MOVIE_FOLDER = os.path.join(ROOT_PATH, SITE_NAME, config_manager.get('DEFAULT', 'movie_folder_name')) + +TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') \ No newline at end of file diff --git a/Test/Util/ffmpegVersion.py b/Test/Util/ffmpegVersion.py new file mode 100644 index 0000000..1fce934 --- /dev/null +++ b/Test/Util/ffmpegVersion.py @@ -0,0 +1,29 @@ +# 05.02.25 + +# Fix import +import sys +import os +src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +sys.path.append(src_path) + + + +from StreamingCommunity.Util.ffmpeg_installer import FFMPEGDownloader + + +def test_ffmpeg_downloader(): + + # Create an instance of the downloader + downloader = FFMPEGDownloader() + + # Check if the download method works and fetches the executables + ffmpeg, ffprobe, ffplay = downloader.download() + + # Output the destination paths + print(f"FFmpeg path: {ffmpeg}") + print(f"FFprobe path: {ffprobe}") + print(f"FFplay path: {ffplay}") + + +if __name__ == "__main__": + test_ffmpeg_downloader() \ No newline at end of file diff --git a/Test/Util/oss.py b/Test/Util/osPath.py similarity index 100% rename from Test/Util/oss.py rename to Test/Util/osPath.py diff --git a/config.json b/config.json index e547b1f..7b659f4 100644 --- a/config.json +++ b/config.json @@ -5,13 +5,13 @@ "log_to_file": false, "show_message": false, "clean_console": true, - "root_path": "/home/giuseppepiccolo/Develop/docker/jellyfin/media/", + "root_path": "Video", "movie_folder_name": "Movie", "serie_folder_name": "Serie", "anime_folder_name": "Anime", - "map_episode_name": "%(tv_name)_S%(season)E%(episode)_%(episode_name)", + "map_episode_name": "S%(season)E%(episode)_%(episode_name)", "config_qbit_tor": { - "host": "192.168.5.172", + "host": "192.168.5.99", "port": "8080", "user": "admin", "pass": "adminadmin" @@ -19,23 +19,23 @@ "add_siteName": false, "disable_searchDomain": false, "not_close": false, - "telegram_bot": true + "telegram_bot": false }, "REQUESTS": { - "timeout": 30, + "timeout": 20, "max_retry": 8, "proxy_start_min": 0.1, "proxy_start_max": 0.5 }, "M3U8_DOWNLOAD": { - "tqdm_delay": 0.12, + "tqdm_delay": 0.15, "default_video_workser": 12, "default_audio_workser": 12, "merge_audio": true, "specific_list_audio": [ "ita" ], - "merge_subs": false, + "merge_subs": true, "specific_list_subtitles": [ "eng", "spa" @@ -79,7 +79,7 @@ "domain": "so" }, "cb01new": { - "domain": "mobi" + "domain": "media" }, "1337xx": { "domain": "to" diff --git a/requirements.txt b/requirements.txt index 21212e1..fbf4453 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,6 @@ pycryptodomex googlesearch-python fake-useragent qbittorrent-api -python-qbittorrent -pyTelegramBotAPI -Pillow \ No newline at end of file +python-qbittorrent +Pillow +pyTelegramBotAPI \ No newline at end of file diff --git a/test_run.py b/test_run.py index 0ca8a16..45aaf2a 100644 --- a/test_run.py +++ b/test_run.py @@ -11,5 +11,4 @@ request_manager.clear_file() script_id = sys.argv[1] if len(sys.argv) > 1 else "unknown" set_session(script_id) - main(script_id) \ No newline at end of file