diff --git a/src/ytdl_sub/config/preset_class_mappings.py b/src/ytdl_sub/config/preset_class_mappings.py index 3a90ddc6..7c8a8673 100644 --- a/src/ytdl_sub/config/preset_class_mappings.py +++ b/src/ytdl_sub/config/preset_class_mappings.py @@ -39,7 +39,7 @@ class DownloadStrategyMapping: "soundcloud": { "albums_and_singles": SoundcloudAlbumsAndSinglesDownloader, }, - "generic": { + "download": { "collection": CollectionDownloader, "source": SourceDownloader, }, diff --git a/src/ytdl_sub/downloaders/generic/collection.py b/src/ytdl_sub/downloaders/generic/collection.py index 7e079505..368a06a8 100644 --- a/src/ytdl_sub/downloaders/generic/collection.py +++ b/src/ytdl_sub/downloaders/generic/collection.py @@ -14,7 +14,7 @@ class CollectionDownloadOptions(CollectionValidator, DownloaderValidator): presets: my_example_preset: - generic: + download: # required download_strategy: "collection" urls: diff --git a/src/ytdl_sub/downloaders/generic/collection_validator.py b/src/ytdl_sub/downloaders/generic/collection_validator.py index ba10467f..3e310d83 100644 --- a/src/ytdl_sub/downloaders/generic/collection_validator.py +++ b/src/ytdl_sub/downloaders/generic/collection_validator.py @@ -162,7 +162,7 @@ class CollectionValidator(StrictDictValidator, AddsVariablesMixin): @classmethod def partial_validate(cls, name: str, value: Any) -> None: """ - Partially validate a generic collection + Partially validate a collection """ if isinstance(value, dict): value["urls"] = value.get("urls", [{"url": "placeholder"}]) diff --git a/src/ytdl_sub/downloaders/generic/source.py b/src/ytdl_sub/downloaders/generic/source.py index a28134c6..f2b4f118 100644 --- a/src/ytdl_sub/downloaders/generic/source.py +++ b/src/ytdl_sub/downloaders/generic/source.py @@ -14,9 +14,9 @@ class SourceDownloadOptions(CollectionUrlValidator, DownloaderValidator): presets: my_example_preset: - generic: + download: # required - download_strategy: "source" + download_strategy: "url" url: "youtube.com/channel/UCsvn_Po0SmunchJYtttWpOxMg" # optional playlist_thumbnails: diff --git a/src/ytdl_sub/prebuilt_presets/music_videos/kodi_music_videos.yaml b/src/ytdl_sub/prebuilt_presets/music_videos/kodi_music_videos.yaml index 86999852..fdd48694 100644 --- a/src/ytdl_sub/prebuilt_presets/music_videos/kodi_music_videos.yaml +++ b/src/ytdl_sub/prebuilt_presets/music_videos/kodi_music_videos.yaml @@ -1,7 +1,7 @@ presets: kodi_music_video: - generic: + download: download_strategy: "source" url: "{music_video_url}" diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml index 98238d8e..72fb74f0 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml @@ -28,7 +28,7 @@ presets: # TV show from any single source. Uses latest entry's thumbnail as tv show poster _tv_show_by_date: - generic: + download: download_strategy: "source" url: "{url}" playlist_thumbnails: @@ -42,7 +42,7 @@ presets: # TV show from a collection. Must specify additional `tv_show_collection_season` presets in # addition. Each season sets its own `collection_season_number/_padded` _tv_show_collection: - generic: + download: download_strategy: "collection" overrides: diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml index f05fe036..e9c2c72b 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml @@ -17,7 +17,7 @@ presets: - "_tv_show_collection" collection_season_1: - generic: + download: download_strategy: "collection" urls: - url: "{collection_season_1_url}" @@ -42,7 +42,7 @@ presets: number: "1" collection_season_2: - generic: + download: download_strategy: "collection" urls: - url: "{collection_season_2_url}" @@ -61,7 +61,7 @@ presets: number: "2" collection_season_3: - generic: + download: download_strategy: "collection" urls: - url: "{collection_season_3_url}" @@ -80,7 +80,7 @@ presets: number: "3" collection_season_4: - generic: + download: download_strategy: "collection" urls: - url: "{collection_season_4_url}" @@ -99,7 +99,7 @@ presets: number: "4" collection_season_5: - generic: + download: download_strategy: "collection" urls: - url: "{collection_season_5_url}" diff --git a/tests/unit/config/test_config_file.py b/tests/unit/config/test_config_file.py index e83ac7f9..542da16d 100644 --- a/tests/unit/config/test_config_file.py +++ b/tests/unit/config/test_config_file.py @@ -68,31 +68,31 @@ class TestConfigFilePartiallyValidatesPresets: def test_error__multiple_sources(self): self._partial_validate( - preset_dict={"youtube": {}, "generic": {}}, + preset_dict={"youtube": {}, "download": {}}, expected_error_message="Validation error in partial_preset: " - "Contains the sources generic, youtube but can only have one", + "Contains the sources download, youtube but can only have one", ) def test_error__no_download_strategy(self): self._partial_validate( - preset_dict={"generic": {}}, - expected_error_message="Validation error in partial_preset.generic: " + preset_dict={"download": {}}, + expected_error_message="Validation error in partial_preset.download: " "missing the required field 'download_strategy'", ) def test_error__bad_download_strategy(self): self._partial_validate( - preset_dict={"generic": {"download_strategy": "fail"}}, - expected_error_message="Validation error in partial_preset.generic: " - "Tried to use download strategy 'fail' with source 'generic', " + preset_dict={"download": {"download_strategy": "fail"}}, + expected_error_message="Validation error in partial_preset.download: " + "Tried to use download strategy 'fail' with source 'download', " "which does not exist. Available download strategies: collection, source", ) def test_error__bad_download_strategy_args(self): self._partial_validate( - preset_dict={"generic": {"download_strategy": "collection", "bad_key": "nope"}}, - expected_error_message="Validation error in partial_preset.generic: " - "'partial_preset.generic' contains the field 'bad_key' which is not allowed. " + preset_dict={"download": {"download_strategy": "collection", "bad_key": "nope"}}, + expected_error_message="Validation error in partial_preset.download: " + "'partial_preset.download' contains the field 'bad_key' which is not allowed. " "Allowed fields: urls", ) @@ -100,7 +100,7 @@ class TestConfigFilePartiallyValidatesPresets: "preset_dict", [ {"nfo_tags": {"tags": {"key-1": {"attributes": {"test": "2"}}}}}, - {"generic": {"urls": [{"variables_to_set": {"name": "value"}}]}}, + {"download": {"urls": [{"variables_to_set": {"name": "value"}}]}}, ], ) def test_partial_validate__incomplete_list_item(self, preset_dict):