From 2a79ac6849b1b1b3b365042f492bd2cabfad7d57 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Fri, 3 Jan 2025 00:24:21 +0300 Subject: [PATCH 1/2] Fix #160 --- .vscode/launch.json | 8 ++++---- app/library/Download.py | 2 ++ app/library/DownloadQueue.py | 4 ++-- app/library/Utils.py | 9 ++++++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 929cc427..10b67dc6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,17 +30,17 @@ "console": "internalConsole", "justMyCode": true, "env": { - "PYDEVD_DISABLE_FILE_VALIDATION": "1", "YTP_CONFIG_PATH": "${workspaceFolder}/var/config", "YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads", "YTP_TEMP_PATH": "${workspaceFolder}/var/tmp", + "PYDEVD_DISABLE_FILE_VALIDATION": "1", "YTP_URL_HOST": "http://localhost:8081", - "YTP_LOG_LEVEL": "DEBUG", - "YTP_DEBUG": "true", - "YTP_YTDL_DEBUG": "true", "YTP_MAX_WORKERS": "2", "YTP_IGNORE_UI": "true", "YTP_PIP_IGNORE_UPDATES": "true", + "YTP_LOG_LEVEL": "DEBUG", + "YTP_DEBUG": "true", + "YTP_YTDL_DEBUG": "true", } }, { diff --git a/app/library/Download.py b/app/library/Download.py index 2428b32e..f5ea4c7d 100644 --- a/app/library/Download.py +++ b/app/library/Download.py @@ -164,6 +164,8 @@ class Download: f'Downloading pid: {os.getpid()} id="{self.info.id}" title="{self.info.title}" preset="{self.preset}".' ) + LOG.debug(f"Params before passing to yt-dlp: {params}") + cls = yt_dlp.YoutubeDL(params=params) if isinstance(self.info_dict, dict) and len(self.info_dict) > 1: diff --git a/app/library/DownloadQueue.py b/app/library/DownloadQueue.py index 8f3ca350..d34d50fe 100644 --- a/app/library/DownloadQueue.py +++ b/app/library/DownloadQueue.py @@ -15,7 +15,7 @@ from .DataStore import DataStore from .Download import Download from .Emitter import Emitter from .ItemDTO import ItemDTO -from .Utils import ExtractInfo, calcDownloadPath, isDownloaded, mergeConfig +from .Utils import ExtractInfo, get_opts, calcDownloadPath, isDownloaded, mergeConfig LOG = logging.getLogger("DownloadQueue") TYPE_DONE: str = "done" @@ -264,7 +264,7 @@ class DownloadQueue: fut=asyncio.get_running_loop().run_in_executor( None, ExtractInfo, - mergeConfig(self.config.ytdl_options, ytdlp_config), + get_opts(preset, mergeConfig(self.config.ytdl_options, ytdlp_config)), url, bool(self.config.ytdl_debug), ), diff --git a/app/library/Utils.py b/app/library/Utils.py index 26f0b21e..7eb6267f 100644 --- a/app/library/Utils.py +++ b/app/library/Utils.py @@ -122,13 +122,16 @@ def ExtractInfo(config: dict, url: str, debug: bool = False) -> dict: **config, } - # Remove keys that are not needed for info extraction as those keys generate files when used with extract_info. - for key in ( + # Remove keys that are not needed for info extraction. + keys: list = [ "writeinfojson", "writethumbnail", "writedescription", "writeautomaticsub", - ): + "postprocessors", + ] + + for key in keys: if key in params: params.pop(key) From 7633f8ffe2ae494ff9d8214cd84e907646a58b4e Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Fri, 3 Jan 2025 00:44:02 +0300 Subject: [PATCH 2/2] fixes --- app/library/ffprobe.py | 8 +++++++- ui/components/VideoPlayer.vue | 26 +++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/library/ffprobe.py b/app/library/ffprobe.py index c396c3df..b2b6a9cf 100644 --- a/app/library/ffprobe.py +++ b/app/library/ffprobe.py @@ -82,7 +82,13 @@ class FFStream: """ Is the stream labelled as a video stream. """ - return self.__dict__.get("codec_type", None) == "video" + if self.__dict__.get("codec_type", None) != "video": + return False + + if self.__dict__.get("codec_name", None) in ["png", "mjpeg", "gif", "bmp", "tiff", "webp"]: + return False + + return True def is_subtitle(self): """ diff --git a/ui/components/VideoPlayer.vue b/ui/components/VideoPlayer.vue index a2083625..1250d04f 100644 --- a/ui/components/VideoPlayer.vue +++ b/ui/components/VideoPlayer.vue @@ -18,7 +18,7 @@