From 3219408a57c81b603857f310bec30479835e7af7 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Tue, 1 Apr 2025 23:19:17 +0300 Subject: [PATCH] Removed last reference for ytdlp JSON config in DownloadQueue --- app/library/DownloadQueue.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/library/DownloadQueue.py b/app/library/DownloadQueue.py index 23e076ae..c98b5c6b 100644 --- a/app/library/DownloadQueue.py +++ b/app/library/DownloadQueue.py @@ -1,7 +1,6 @@ import asyncio import functools import glob -import json import logging import os import time @@ -341,7 +340,7 @@ class DownloadQueue(metaclass=Singleton): if item.has_cli(): try: - config = arg_converter(args=item.cli, level=True) + arg_converter(args=item.cli, level=True) except Exception as e: LOG.error(f"Invalid cli options '{item.cli}'. {e!s}") return {"status": "error", "msg": f"Invalid cli options '{item.cli}'. {e!s}"} @@ -361,13 +360,6 @@ class DownloadQueue(metaclass=Singleton): LOG.info(f"Adding '{item.__repr__()}'.") - if isinstance(config, str): - try: - config = json.loads(config) - except Exception as e: - LOG.error(f"Unable to load '{config=}'. {e!s}") - return {"status": "error", "msg": f"Failed to parse json yt-dlp config. {e!s}"} - already = set() if already is None else already if item.url in already: @@ -393,7 +385,7 @@ class DownloadQueue(metaclass=Singleton): "func": lambda _, msg: logs.append(msg), "level": logging.WARNING, }, - **YTDLPOpts.get_instance().preset(name=item.preset).add(config=config, from_user=True).get_all(), + **YTDLPOpts.get_instance().preset(name=item.preset).add_cli(config=item.cli, from_user=True).get_all(), } if item.cookies: @@ -402,7 +394,9 @@ class DownloadQueue(metaclass=Singleton): await f.write(item.cookies) yt_conf["cookiefile"] = f.name except ValueError as e: - LOG.error(f"Failed to create cookie file for '{self.info.id}: {self.info.title}'. '{e!s}'.") + msg = f"Failed to create cookie file for '{self.info.id}: {self.info.title}'. '{e!s}'." + LOG.error(msg) + return {"status": "error", "msg": msg} entry = await asyncio.wait_for( fut=asyncio.get_running_loop().run_in_executor(