From c9af30edda997db990ea6d617da70b2f4be30893 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Mon, 1 Sep 2025 19:35:35 +0300 Subject: [PATCH] Refactor arg_converter usage to remove logging of removed options in Item and YTDLPOpts classes --- app/library/ItemDTO.py | 6 +----- app/library/YTDLPOpts.py | 16 +--------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/app/library/ItemDTO.py b/app/library/ItemDTO.py index 02d9ae17..a35ccd85 100644 --- a/app/library/ItemDTO.py +++ b/app/library/ItemDTO.py @@ -151,11 +151,7 @@ class Item: from .Utils import arg_converter try: - removed_options: list = [] - arg_converter(args=cli, level=True, removed_options=removed_options) - if len(removed_options) > 0: - LOG.warning("Removed the following options '%s' for '%s'.", ", ".join(removed_options), url) - + arg_converter(args=cli, level=True) data["cli"] = cli except Exception as e: msg = f"Failed to parse command options for yt-dlp. {e!s}" diff --git a/app/library/YTDLPOpts.py b/app/library/YTDLPOpts.py index cd33bfb1..ee421357 100644 --- a/app/library/YTDLPOpts.py +++ b/app/library/YTDLPOpts.py @@ -76,18 +76,12 @@ class YTDLPOpts: if from_user: bad_options: dict[str, str] = {k: v for d in REMOVE_KEYS for k, v in d.items()} - removed_options: list = [] - for key, value in config.items(): if from_user and key in bad_options: - removed_options.append(bad_options[key]) continue self._item_opts[key] = value - if len(removed_options) > 0: - LOG.warning("Removed the following options: '%s'.", ", ".join(removed_options)) - return self def preset(self, name: str) -> "YTDLPOpts": @@ -175,15 +169,7 @@ class YTDLPOpts: if len(self._item_cli) > 0: try: - removed_options: list = [] - user_cli: dict = arg_converter( - args="\n".join(self._item_cli), - level=True, - removed_options=removed_options, - ) - - if len(removed_options) > 0: - LOG.warning("Removed the following options: '%s'.", ", ".join(removed_options)) + user_cli: dict = arg_converter(args="\n".join(self._item_cli), level=True) except Exception as e: msg = f"Invalid command options for yt-dlp were given. '{e!s}'." raise ValueError(msg) from e