no download_strategy

This commit is contained in:
Jesse Bannon 2024-01-12 22:14:18 -08:00
parent b64a58f467
commit 91e38a2966
2 changed files with 3 additions and 12 deletions

View file

@ -276,17 +276,11 @@ class MultiUrlValidator(OptionsValidator):
def __init__(self, name, value):
super().__init__(name, value)
# Copy since we're popping things
value_copy = copy.deepcopy(value)
if isinstance(value, dict):
# Pop old required field in case it's still there
value_copy.pop("download_strategy", None)
# Deal with old multi-url download strategy
if isinstance(value, dict) and "urls" in value_copy:
self._urls = UrlListValidator(name=name, value=value_copy["urls"])
if isinstance(value, dict) and "urls" in value:
self._urls = UrlListValidator(name=name, value=value["urls"])
else:
self._urls = UrlListValidator(name=name, value=value_copy)
self._urls = UrlListValidator(name=name, value=value)
@property
def urls(self) -> UrlListValidator:

View file

@ -17,9 +17,6 @@ class TestPreset:
"youtube.com/watch?v=123abc", # single string
["youtube.com/watch?v=123abc", "youtube.com/watch?v=123xyz"], # list of strings
[{"url": "youtube.com/watch?v=123abc"}, "youtube.com/watch?v=123abc"], # dict and str
# OLD download_strategy format
{"download_strategy": "url", "url": "youtube.com/watch?v=123abc"},
{"download_strategy": "multi-url", "urls": [{"url": "youtube.com/watch?v=123abc"}]},
],
)
def test_bare_minimum_preset(self, config_file, output_options, download_value):