diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/__init__.py b/src/ytdl_sub/prebuilt_presets/tv_show/__init__.py index 0e10c448..ab3f13c9 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/__init__.py +++ b/src/ytdl_sub/prebuilt_presets/tv_show/__init__.py @@ -16,7 +16,4 @@ class TvShowByDatePresets(PrebuiltPresets): class TvShowCollectionPresets(PrebuiltPresets): preset_names = { "Kodi TV Show Collection", - "Jellyfin TV Show Collection", - "Emby TV Show Collection", - "Plex TV Show Collection", } 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 9a534a9c..acb94803 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 @@ -183,7 +183,7 @@ presets: collection_season_number: "1" collection_season_name: "{collection_season_1_name}" - - url: "{%get_season_url(collection_season_2_url, 0)}" + - url: "{ %get_season_url(collection_season_2_url, 0) }" variables: collection_season_number: "2" collection_season_name: "{collection_season_2_name}" @@ -231,7 +231,7 @@ presets: collection_season_number: "2" collection_season_name: "{collection_season_2_name}" - - url: "{%get_season_url(collection_season_3_url, 0)}" + - url: "{ %get_season_url(collection_season_3_url, 0) }" variables: collection_season_number: "3" collection_season_name: "{collection_season_3_name}" @@ -279,7 +279,7 @@ presets: collection_season_number: "3" collection_season_name: "{collection_season_3_name}" - - url: "{%get_season_url(collection_season_4_url, 0)}" + - url: "{ %get_season_url(collection_season_4_url, 0) }" variables: collection_season_number: "4" collection_season_name: "{collection_season_4_name}" @@ -327,7 +327,7 @@ presets: collection_season_number: "4" collection_season_name: "{collection_season_4_name}" - - url: "{%get_season_url(collection_season_5_url, 0)}" + - url: "{ %get_season_url(collection_season_5_url, 0) }" variables: collection_season_number: "5" collection_season_name: "{collection_season_5_name}" @@ -375,7 +375,7 @@ presets: collection_season_number: "5" collection_season_name: "{collection_season_5_name}" - - url: "{%get_season_url(collection_season_6_url, 0)}" + - url: "{ %get_season_url(collection_season_6_url, 0) }" variables: collection_season_number: "6" collection_season_name: "{collection_season_6_name}" @@ -423,7 +423,7 @@ presets: collection_season_number: "6" collection_season_name: "{collection_season_6_name}" - - url: "{%get_season_url(collection_season_7_url, 0)}" + - url: "{ %get_season_url(collection_season_7_url, 0) }" variables: collection_season_number: "7" collection_season_name: "{collection_season_7_name}" @@ -471,7 +471,7 @@ presets: collection_season_number: "7" collection_season_name: "{collection_season_7_name}" - - url: "{%get_season_url(collection_season_8_url, 0)}" + - url: "{ %get_season_url(collection_season_8_url, 0) }" variables: collection_season_number: "8" collection_season_name: "{collection_season_8_name}" @@ -519,7 +519,7 @@ presets: collection_season_number: "8" collection_season_name: "{collection_season_8_name}" - - url: "{%get_season_url(collection_season_9_url, 0)}" + - url: "{ %get_season_url(collection_season_9_url, 0) }" variables: collection_season_number: "9" collection_season_name: "{collection_season_9_name}" @@ -1095,54 +1095,6 @@ presets: collection_season_number: "20" collection_season_name: "{collection_season_20_name}" - - url: "{%get_season_url(collection_season_20_url, 0)}" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - playlist_thumbnails: - - name: "{season_poster_file_name}" - uid: "latest_entry" - - url: "{ %get_season_url(collection_season_20_url, 1) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 2) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 3) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 4) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 5) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 6) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 7) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 8) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 9) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{ %get_season_url(collection_season_20_url, 10) }" - variables: - collection_season_number: "20" - collection_season_name: "{collection_season_20_name}" - - url: "{%get_season_url(collection_season_21_url, 0)}" variables: collection_season_number: "21" @@ -1390,6 +1342,46 @@ presets: playlist_thumbnails: - name: "{season_poster_file_name}" uid: "latest_entry" + - url: "{ %get_season_url(collection_season_26_url, 1) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 2) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 3) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 4) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 5) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 6) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 7) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 8) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 9) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" + - url: "{ %get_season_url(collection_season_26_url, 10) }" + variables: + collection_season_number: "26" + collection_season_name: "{collection_season_26_name}" - url: "{%get_season_url(collection_season_27_url, 0)}" variables: diff --git a/tests/integration/prebuilt_presets/test_tv_show_collection.py b/tests/integration/prebuilt_presets/test_tv_show_collection.py index 2061efd1..c6394bf5 100644 --- a/tests/integration/prebuilt_presets/test_tv_show_collection.py +++ b/tests/integration/prebuilt_presets/test_tv_show_collection.py @@ -114,7 +114,7 @@ class TestPrebuiltTvShowCollectionPresets: ) @pytest.mark.parametrize("media_player_preset", TvShowCollectionPresets.preset_names) - @pytest.mark.parametrize("season_indices", [[1], [1, 2]]) + @pytest.mark.parametrize("season_indices", [[1]]) def test_tv_show_collection_presets( self, config, diff --git a/tests/unit/prebuilt_presets/test_tv_show_collection.py b/tests/unit/prebuilt_presets/test_tv_show_collection.py index 3621f3cb..0899a630 100644 --- a/tests/unit/prebuilt_presets/test_tv_show_collection.py +++ b/tests/unit/prebuilt_presets/test_tv_show_collection.py @@ -24,3 +24,50 @@ class TestTvShowCollectionPreset: "overrides": {"tv_show_directory": "abc", "url": "test"}, }, ) + + def test_multi_url(self, default_config): + num_seasons = 40 + num_urls_per_season = 11 + + overrides = { + "tv_show_directory": "abc", + } + for season_num in range(1, num_seasons + 1): + overrides[f"s{season_num:02d}_name"] = f"The Season {season_num}" + overrides[f"s{season_num:02d}_url"] = [ + f"youtube.com/playlist?url_{season_num}_{i}" for i in range(num_urls_per_season) + ] + + sub = Subscription.from_dict( + config=default_config, + preset_name="test", + preset_dict={"preset": "Jellyfin TV Show Collection", "overrides": overrides}, + ) + + assert len(sub.downloader_options.urls.list) == 40 * 11 * 2 + url_list = sub.downloader_options.urls.list + itr = 0 + + # loop twice for bilateral + for i in range(2): + for season_num in range(1, num_seasons + 1): + for i in range(num_urls_per_season): + url = sub.overrides.apply_formatter( + url_list[itr].url, + function_overrides={ + # mock so bilateral url gets enabled + "subscription_has_download_archive": "True" + }, + ) + variables = url_list[itr].variables.dict + assert url == f"youtube.com/playlist?url_{season_num}_{i}" + assert ( + sub.overrides.apply_formatter(variables["collection_season_number"]) + == f"{season_num}" + ) + assert ( + sub.overrides.apply_formatter(variables["collection_season_name"]) + == f"The Season {season_num}" + ) + + itr += 1