From 2cbfbc99001083d57f42a03da70fd32477c5e057 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Mon, 14 Jul 2025 15:46:21 -0700 Subject: [PATCH] [FEATURE] Shuffle subscription arg --- src/ytdl_sub/cli/entrypoint.py | 6 ++++++ src/ytdl_sub/cli/parsers/main.py | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/ytdl_sub/cli/entrypoint.py b/src/ytdl_sub/cli/entrypoint.py index eace6173..3e300d91 100644 --- a/src/ytdl_sub/cli/entrypoint.py +++ b/src/ytdl_sub/cli/entrypoint.py @@ -74,6 +74,7 @@ def _download_subscriptions_from_yaml_files( subscription_override_dict: Dict, update_with_info_json: bool, dry_run: bool, + shuffle: bool, ) -> List[Subscription]: """ Downloads all subscriptions from one or many subscription yaml files. @@ -90,6 +91,8 @@ def _download_subscriptions_from_yaml_files( Whether to actually download or update using existing info json dry_run Whether to dry run or not + shuffle + Whether to shuffle the subscription download order Returns ------- @@ -111,6 +114,8 @@ def _download_subscriptions_from_yaml_files( subscription_override_dict=subscription_override_dict, ) + # TODO: shuffle + for subscription in subscriptions: with subscription.exception_handling(): logger.info( @@ -248,6 +253,7 @@ def main() -> List[Subscription]: subscription_override_dict=subscription_override_dict, update_with_info_json=args.update_with_info_json, dry_run=args.dry_run, + shuffle=args.shuffle, ) # One-off download diff --git a/src/ytdl_sub/cli/parsers/main.py b/src/ytdl_sub/cli/parsers/main.py index daa4d5ea..397daff6 100644 --- a/src/ytdl_sub/cli/parsers/main.py +++ b/src/ytdl_sub/cli/parsers/main.py @@ -172,6 +172,10 @@ class SubArguments: short="-o", long="--dl-override", ) + SHUFFLE = CLIArgument( + short="-sh", + long="--shuffle", + ) subscription_parser = subparsers.add_parser("sub") @@ -197,6 +201,13 @@ subscription_parser.add_argument( help="override all subscription config values using `dl` syntax, " "i.e. --dl-override='--ytdl_options.max_downloads 3'", ) +subscription_parser.add_argument( + SubArguments.SHUFFLE.short, + SubArguments.OVERRIDE.long, + action="store_true", + help="shuffle subscription order when downloading", + default=False, +) ################################################################################################### # DOWNLOAD PARSER