diff --git a/docs/source/prebuilt_presets/tv_shows.rst b/docs/source/prebuilt_presets/tv_shows.rst index cbb18f66..ee8f3368 100644 --- a/docs/source/prebuilt_presets/tv_shows.rst +++ b/docs/source/prebuilt_presets/tv_shows.rst @@ -187,11 +187,17 @@ Must define ``tv_show_directory``. Available presets: s02_name: "Covers" s02_url: "https://www.youtube.com/playlist?list=PLE62gWlWZk5NWVAVuf0Lm9jdv_-_KXs0W" -Individual seasons support both single and multi URL: +Other notable features include: +- Individual seasons support both single and multi URL. +- Season 0 is supported .. code-block:: yaml "~Beyond the Guitar": + s00_name: "Specials" + s00_url: + - "https://www.youtube.com/watch?v=vXzguOdulAI" + - "https://www.youtube.com/watch?v=IGwYDvaGAz0" s01_name: "Videos" s01_url: - "https://www.youtube.com/c/BeyondTheGuitar" 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 acb94803..29019cb2 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 @@ -2056,6 +2056,55 @@ presets: collection_season_number: "40" collection_season_name: "{collection_season_40_name}" + # Place season 0 at end + - url: "{ %get_season_url(collection_season_0_url, 0) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + playlist_thumbnails: + - name: "{season_poster_file_name}" + uid: "latest_entry" + - url: "{ %get_season_url(collection_season_0_url, 1) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 2) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 3) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 4) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 5) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 6) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 7) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 8) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 9) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + - url: "{ %get_season_url(collection_season_0_url, 10) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + output_directory_nfo_tags: @@ -2228,6 +2277,7 @@ presets: collection_season_38_name: "{s38_name}" collection_season_39_name: "{s39_name}" collection_season_40_name: "{s40_name}" + collection_season_0_name: "{s00_name}" # Legacy url variable collection_season_1_url: "{s01_url}" @@ -2270,6 +2320,7 @@ presets: collection_season_38_url: "{s38_url}" collection_season_39_url: "{s39_url}" collection_season_40_url: "{s40_url}" + collection_season_0_url: "{s00_url}" s01_name: "" s02_name: "" @@ -2311,6 +2362,7 @@ presets: s38_name: "" s39_name: "" s40_name: "" + s00_name: "" s01_url: "" s02_url: "" @@ -2352,6 +2404,7 @@ presets: s38_url: "" s39_url: "" s40_url: "" + s00_url: "" # $0 - season url variable # $1 - get the i'th url from the array @@ -5505,6 +5558,84 @@ presets: ytdl_options: playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 0) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 1) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 2) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 3) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 4) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 5) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 6) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 7) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 8) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 9) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + - url: "{ %bilateral_url( %get_season_url(collection_season_0_url, 10) ) }" + variables: + collection_season_number: "0" + collection_season_name: "{collection_season_0_name}" + download_reverse: False + ytdl_options: + playlist_items: "-1:0:-1" + _tv_show_collection_asserts: overrides: diff --git a/tests/unit/prebuilt_presets/test_tv_show_collection.py b/tests/unit/prebuilt_presets/test_tv_show_collection.py index 0899a630..f56755b8 100644 --- a/tests/unit/prebuilt_presets/test_tv_show_collection.py +++ b/tests/unit/prebuilt_presets/test_tv_show_collection.py @@ -26,13 +26,13 @@ class TestTvShowCollectionPreset: ) def test_multi_url(self, default_config): - num_seasons = 40 + num_seasons = 40 # excluding season 0 num_urls_per_season = 11 overrides = { "tv_show_directory": "abc", } - for season_num in range(1, num_seasons + 1): + for season_num in range(0, 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) @@ -44,13 +44,17 @@ class TestTvShowCollectionPreset: preset_dict={"preset": "Jellyfin TV Show Collection", "overrides": overrides}, ) - assert len(sub.downloader_options.urls.list) == 40 * 11 * 2 + assert len(sub.downloader_options.urls.list) == (num_seasons + 1) * num_urls_per_season * 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 season_num in range(1, num_seasons + 2): + # Season 0 is placed last, adjust here + if season_num == num_seasons + 1: + season_num = 0 + for i in range(num_urls_per_season): url = sub.overrides.apply_formatter( url_list[itr].url,