TV Show by Date support with docs. TODO: use release-date for archive if upload-date not present

This commit is contained in:
Jesse Bannon 2025-05-04 20:16:38 -07:00
parent a74fc42d9f
commit 7e7a17d705
4 changed files with 73 additions and 42 deletions

View file

@ -634,7 +634,7 @@ capitalize
concat
~~~~~~
:spec: ``concat(values: String, ...) -> String``
:spec: ``concat(values: AnyArgument, ...) -> String``
:description:
Concatenate multiple Strings into a single String.

View file

@ -74,24 +74,47 @@ Must define ``tv_show_directory``. Available presets:
Advanced Usage
~~~~~~~~~~~~~~
If you prefer a different organization method, you can instead apply multiple presets to your subscriptions.
If you prefer a different season/episode organization method, you can set the following override variables.
You will need a base of one of the below:
.. code-block:: yaml
* ``kodi_tv_show_by_date``
* ``jellyfin_tv_show_by_date``
* ``plex_tv_show_by_date``
__preset__:
overrides:
tv_show_directory: "/tv_shows"
tv_show_by_date_season_ordering: "year-month"
tv_show_by_date_episode_ordering: "day"
And then add one of these:
Or for a specific preset
* ``season_by_year__episode_by_month_day``
* ``season_by_year_month__episode_by_day``
* ``season_by_year__episode_by_month_day_reversed``
* Episode numbers are reversed, meaning more recent episodes appear at the top of a season by having a lower value.
* ``season_by_year__episode_by_download_index``
* Episodes are numbered by the download order. NOTE that this is fetched using the length of the download archive. Do not use if you intend to remove old videos.
.. code-block:: yaml
"~Kids Toys Play":
url: "https://www.youtube.com/@KidsToysPlayChannel"
tv_show_by_date_season_ordering: "year-month"
tv_show_by_date_episode_ordering: "day"
The following are supported.
**tv_show_by_date_season_ordering**
* upload-year
* upload-year-month
* release-year
* release-year-month
**tv_show_by_date_episode_ordering**
* upload-day
* upload-month-day
* upload-month-day-reversed
* Reversed means more recent episodes appear at the top of a season by having a lower value.
* release-day
* release-month-day
* release-month-day-reversed
* download-index
* Episodes are numbered by the download order. **NOTE**: this is fetched using the length of the download archive. Do not use if you intend to remove old videos.
TV Show Collection

View file

@ -63,16 +63,18 @@ presets:
tv_show_by_date_season_ordering: >-
{ %throw("Must specify tv_show_by_date_season_ordering") }
"%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),
%season_ordering_( "upload-year" ), upload_year,
%season_ordering_( "upload-year-month" ), %concat(upload_year, upload_month_padded),
%season_ordering_( "release-year" ), release_year,
%season_ordering_( "release-year-month" ), %concat(release_year, release_month_padded),
%throw(
"tv_show_by_date_season_ordering must be one of the following: 'year', 'year-month'"
'tv_show_by_date_season_ordering must be one of the following: "upload-year", "upload-year-month", "release-year", "release-year-month"'
)
)
}
@ -80,66 +82,72 @@ presets:
# 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") }
tv_show_by_date_episode_ordering: >-
{ %throw("Must specify tv_show_by_date_episode_ordering") }
"%season_ordering_":
{ %eq( %lower(tv_show_by_date_season_ordering), $0 ) }
"%episode_ordering_": >-
{ %eq( %lower(tv_show_by_date_episode_ordering), $0 ) }
season_number: >-
episode_number_and_padded_: >-
{
%elif(
%season_ordering_( "year" ), upload_year,
%season_ordering_( "year-month" ), %concat(upload_year, upload_month_padded),
%episode_ordering_( "upload-day" ), [ %concat(upload_day, upload_date_index_padded), 4 ],
%episode_ordering_( "upload-month-day" ), [ %concat(upload_month, upload_day_padded, upload_date_index_padded), 6],
%episode_ordering_( "upload-month-day-reversed" ), [ %concat(upload_day_of_year_reversed, upload_date_index_reversed_padded), 5],
%episode_ordering_( "release-day" ), [ %concat(release_day, upload_date_index_padded), 4 ],
%episode_ordering_( "release-month-day" ), [ %concat(release_month, release_day_padded, upload_date_index_padded), 6],
%episode_ordering_( "release-month-day-reversed" ), [ %concat(release_day_of_year_reversed, upload_date_index_reversed_padded), 5],
%episode_ordering_( "download-index" ), [ download_index, 6 ],
%throw(
"tv_show_by_date_season_ordering must be one of the following: 'year', 'year-month'"
'tv_show_by_date_episode_ordering must be one of the following: "upload-day", "upload-month-day", "upload-month-day-reversed", "release-day", "release-month-day", "release-month-day-reversed", "download-index"'
)
)
}
# both year and year-month are fixed width, until the year 10000 :)
season_number_padded: "{season_number}"
episode_number: "{ %array_at(episode_number_and_padded_, 0) }"
episode_number_padded: "{ %pad_zero( %int(episode_number), %int(%array_at(episode_number_and_padded_, 1))) }"
####################################################################################################
# LEGACY PRESETS
_season_by_year:
preset: "_tv_show_by_date_season_ordering"
overrides:
tv_show_by_date_season_ordering: "year"
tv_show_by_date_season_ordering: "upload-year"
_season_by_year_month:
preset: "_tv_show_by_date_season_ordering"
overrides:
tv_show_by_date_season_ordering: "year-month"
tv_show_by_date_season_ordering: "upload-year-month"
####################################################################################################
season_by_year_month__episode_by_day:
preset:
- "_season_by_year_month"
- "_tv_show_by_date_episode_ordering"
overrides:
episode_number: "{upload_day}{upload_date_index_padded}"
episode_number_padded: "{upload_day_padded}{upload_date_index_padded}"
tv_show_by_date_episode_ordering: "upload-day"
season_by_year__episode_by_month_day:
preset:
- "_season_by_year"
- "_tv_show_by_date_episode_ordering"
overrides:
episode_number: "{upload_month}{upload_day_padded}{upload_date_index_padded}"
episode_number_padded: "{upload_month_padded}{upload_day_padded}{upload_date_index_padded}"
tv_show_by_date_episode_ordering: "upload-month-day"
season_by_year__episode_by_month_day_reversed:
preset:
- "_season_by_year"
- "_tv_show_by_date_episode_ordering"
overrides:
episode_number: "{upload_day_of_year_reversed}{upload_date_index_reversed_padded}"
episode_number_padded: "{upload_day_of_year_reversed_padded}{upload_date_index_reversed_padded}"
tv_show_by_date_episode_ordering: "upload-month-day-reversed"
season_by_year__episode_by_download_index:
preset:
- "_season_by_year"
- "_tv_show_by_date_episode_ordering"
overrides:
episode_number: "{download_index}"
episode_number_padded: "{download_index_padded6}"
tv_show_by_date_episode_ordering: "download-index"

View file

@ -127,12 +127,12 @@ class StringFunctions:
return Array([String(split_val) for split_val in string.value.split(sep=sep.value)])
@staticmethod
def concat(*values: String) -> String:
def concat(*values: AnyArgument) -> String:
"""
:description:
Concatenate multiple Strings into a single String.
"""
return String("".join(val.value for val in values))
return String("".join(str(val.value) for val in values))
@staticmethod
def pad(string: String, length: Integer, char: String) -> String: