This commit is contained in:
ArabCoders 2025-01-03 00:24:21 +03:00
parent ee8151ed64
commit 2a79ac6849
4 changed files with 14 additions and 9 deletions

8
.vscode/launch.json vendored
View file

@ -30,17 +30,17 @@
"console": "internalConsole", "console": "internalConsole",
"justMyCode": true, "justMyCode": true,
"env": { "env": {
"PYDEVD_DISABLE_FILE_VALIDATION": "1",
"YTP_CONFIG_PATH": "${workspaceFolder}/var/config", "YTP_CONFIG_PATH": "${workspaceFolder}/var/config",
"YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads", "YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads",
"YTP_TEMP_PATH": "${workspaceFolder}/var/tmp", "YTP_TEMP_PATH": "${workspaceFolder}/var/tmp",
"PYDEVD_DISABLE_FILE_VALIDATION": "1",
"YTP_URL_HOST": "http://localhost:8081", "YTP_URL_HOST": "http://localhost:8081",
"YTP_LOG_LEVEL": "DEBUG",
"YTP_DEBUG": "true",
"YTP_YTDL_DEBUG": "true",
"YTP_MAX_WORKERS": "2", "YTP_MAX_WORKERS": "2",
"YTP_IGNORE_UI": "true", "YTP_IGNORE_UI": "true",
"YTP_PIP_IGNORE_UPDATES": "true", "YTP_PIP_IGNORE_UPDATES": "true",
"YTP_LOG_LEVEL": "DEBUG",
"YTP_DEBUG": "true",
"YTP_YTDL_DEBUG": "true",
} }
}, },
{ {

View file

@ -164,6 +164,8 @@ class Download:
f'Downloading pid: {os.getpid()} id="{self.info.id}" title="{self.info.title}" preset="{self.preset}".' 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) cls = yt_dlp.YoutubeDL(params=params)
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1: if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:

View file

@ -15,7 +15,7 @@ from .DataStore import DataStore
from .Download import Download from .Download import Download
from .Emitter import Emitter from .Emitter import Emitter
from .ItemDTO import ItemDTO from .ItemDTO import ItemDTO
from .Utils import ExtractInfo, calcDownloadPath, isDownloaded, mergeConfig from .Utils import ExtractInfo, get_opts, calcDownloadPath, isDownloaded, mergeConfig
LOG = logging.getLogger("DownloadQueue") LOG = logging.getLogger("DownloadQueue")
TYPE_DONE: str = "done" TYPE_DONE: str = "done"
@ -264,7 +264,7 @@ class DownloadQueue:
fut=asyncio.get_running_loop().run_in_executor( fut=asyncio.get_running_loop().run_in_executor(
None, None,
ExtractInfo, ExtractInfo,
mergeConfig(self.config.ytdl_options, ytdlp_config), get_opts(preset, mergeConfig(self.config.ytdl_options, ytdlp_config)),
url, url,
bool(self.config.ytdl_debug), bool(self.config.ytdl_debug),
), ),

View file

@ -122,13 +122,16 @@ def ExtractInfo(config: dict, url: str, debug: bool = False) -> dict:
**config, **config,
} }
# Remove keys that are not needed for info extraction as those keys generate files when used with extract_info. # Remove keys that are not needed for info extraction.
for key in ( keys: list = [
"writeinfojson", "writeinfojson",
"writethumbnail", "writethumbnail",
"writedescription", "writedescription",
"writeautomaticsub", "writeautomaticsub",
): "postprocessors",
]
for key in keys:
if key in params: if key in params:
params.pop(key) params.pop(key)