From a74fc42d9f9b3404a1196ae47a22023824f44a55 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Sun, 4 May 2025 19:11:20 -0700 Subject: [PATCH] [FEATURE] Change season/ep ordering via variables --- .../tv_show/tv_show_by_date.yaml | 54 +++++++++++++++++-- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml index bca76405..7eb58fbd 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml @@ -56,19 +56,63 @@ presets: "Provided `s01_url` or `s01_name` variable to TV Show by Date preset when it expects `url`. Perhaps you meant to use the `TV Show Collection` preset?" ) } - #################################################################################################### + _tv_show_by_date_season_ordering: + overrides: + tv_show_by_date_season_ordering: >- + { %throw("Must specify tv_show_by_date_season_ordering") } + + "%season_ordering_": + { %eq( %lower(tv_show_by_date_season_ordering), $0 ) } + + season_number: >- + { + %elif( + %season_ordering_( "year" ), upload_year, + %season_ordering_( "year-month" ), %concat(upload_year, upload_month_padded), + %throw( + "tv_show_by_date_season_ordering must be one of the following: 'year', 'year-month'" + ) + ) + } + + # both year and year-month are fixed width, until the year 10000 :) + season_number_padded: "{season_number}" + + # TODO + _tv_show_by_date_episode_ordering: + overrides: + tv_show_by_date_season_ordering: >- + { %throw("Must specify tv_show_by_date_season_ordering") } + + "%season_ordering_": + { %eq( %lower(tv_show_by_date_season_ordering), $0 ) } + + season_number: >- + { + %elif( + %season_ordering_( "year" ), upload_year, + %season_ordering_( "year-month" ), %concat(upload_year, upload_month_padded), + %throw( + "tv_show_by_date_season_ordering must be one of the following: 'year', 'year-month'" + ) + ) + } + + # both year and year-month are fixed width, until the year 10000 :) + season_number_padded: "{season_number}" + +#################################################################################################### +# LEGACY PRESETS _season_by_year: overrides: - season_number: "{upload_year}" - season_number_padded: "{season_number}" + tv_show_by_date_season_ordering: "year" _season_by_year_month: overrides: - season_number: "{upload_year}{upload_month_padded}" - season_number_padded: "{season_number}" + tv_show_by_date_season_ordering: "year-month" ####################################################################################################