[FEATURE] Shuffle subscription arg
This commit is contained in:
parent
6c180c9478
commit
2cbfbc9900
2 changed files with 17 additions and 0 deletions
|
|
@ -74,6 +74,7 @@ def _download_subscriptions_from_yaml_files(
|
||||||
subscription_override_dict: Dict,
|
subscription_override_dict: Dict,
|
||||||
update_with_info_json: bool,
|
update_with_info_json: bool,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
|
shuffle: bool,
|
||||||
) -> List[Subscription]:
|
) -> List[Subscription]:
|
||||||
"""
|
"""
|
||||||
Downloads all subscriptions from one or many subscription yaml files.
|
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
|
Whether to actually download or update using existing info json
|
||||||
dry_run
|
dry_run
|
||||||
Whether to dry run or not
|
Whether to dry run or not
|
||||||
|
shuffle
|
||||||
|
Whether to shuffle the subscription download order
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
|
|
@ -111,6 +114,8 @@ def _download_subscriptions_from_yaml_files(
|
||||||
subscription_override_dict=subscription_override_dict,
|
subscription_override_dict=subscription_override_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO: shuffle
|
||||||
|
|
||||||
for subscription in subscriptions:
|
for subscription in subscriptions:
|
||||||
with subscription.exception_handling():
|
with subscription.exception_handling():
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
@ -248,6 +253,7 @@ def main() -> List[Subscription]:
|
||||||
subscription_override_dict=subscription_override_dict,
|
subscription_override_dict=subscription_override_dict,
|
||||||
update_with_info_json=args.update_with_info_json,
|
update_with_info_json=args.update_with_info_json,
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
|
shuffle=args.shuffle,
|
||||||
)
|
)
|
||||||
|
|
||||||
# One-off download
|
# One-off download
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,10 @@ class SubArguments:
|
||||||
short="-o",
|
short="-o",
|
||||||
long="--dl-override",
|
long="--dl-override",
|
||||||
)
|
)
|
||||||
|
SHUFFLE = CLIArgument(
|
||||||
|
short="-sh",
|
||||||
|
long="--shuffle",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
subscription_parser = subparsers.add_parser("sub")
|
subscription_parser = subparsers.add_parser("sub")
|
||||||
|
|
@ -197,6 +201,13 @@ subscription_parser.add_argument(
|
||||||
help="override all subscription config values using `dl` syntax, "
|
help="override all subscription config values using `dl` syntax, "
|
||||||
"i.e. --dl-override='--ytdl_options.max_downloads 3'",
|
"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
|
# DOWNLOAD PARSER
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue