This commit is contained in:
Jesse Bannon 2023-12-29 14:06:16 -08:00
parent 8d288c7f5a
commit f4d5dd2260
5 changed files with 549 additions and 242 deletions

View file

@ -7,110 +7,163 @@ Entry Variables
channel channel
~~~~~~~ ~~~~~~~
The channel name if it exists, otherwise returns the uploader. :type: ``String``
:description:
The channel name if it exists, otherwise returns the uploader.
channel_id channel_id
~~~~~~~~~~ ~~~~~~~~~~
The channel id if it exists, otherwise returns the entry uploader ID. :type: ``String``
:description:
The channel id if it exists, otherwise returns the entry uploader ID.
chapters chapters
~~~~~~~~ ~~~~~~~~
Chapters if they exist :type: ``Array``
:description:
Chapters if they exist
comments comments
~~~~~~~~ ~~~~~~~~
Comments if they are requested :type: ``Array``
:description:
Comments if they are requested
creator creator
~~~~~~~ ~~~~~~~
The creator name if it exists, otherwise returns the channel. :type: ``String``
:description:
The creator name if it exists, otherwise returns the channel.
description description
~~~~~~~~~~~ ~~~~~~~~~~~
The description if it exists. Otherwise, returns an emtpy string. :type: ``String``
:description:
The description if it exists. Otherwise, returns an emtpy string.
duration duration
~~~~~~~~ ~~~~~~~~
The duration of the entry in seconds :type: ``Integer``
:description:
The duration of the entry in seconds if it exists. Defaults to zero otherwise.
epoch epoch
~~~~~ ~~~~~
The unix epoch of when the metadata was scraped by yt-dlp. :type: ``Integer``
:description:
The unix epoch of when the metadata was scraped by yt-dlp.
epoch_date epoch_date
~~~~~~~~~~ ~~~~~~~~~~
The epoch's date, in YYYYMMDD format. :type: ``String``
:description:
The epoch's date, in YYYYMMDD format.
epoch_hour epoch_hour
~~~~~~~~~~ ~~~~~~~~~~
The epoch's hour :type: ``String``
:description:
The epoch's hour
ext ext
~~~ ~~~
The downloaded entry's file extension :type: ``String``
:description:
The downloaded entry's file extension
extractor extractor
~~~~~~~~~ ~~~~~~~~~
The yt-dlp extractor name :type: ``String``
:description:
The yt-dlp extractor name
extractor_key extractor_key
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
The yt-dlp extractor key :type: ``String``
:description:
The yt-dlp extractor key
ie_key ie_key
~~~~~~ ~~~~~~
The ie_key, used in legacy yt-dlp things as the 'info-extractor key' :type: ``String``
:description:
The ie_key, used in legacy yt-dlp things as the 'info-extractor key'.
If it does not exist, return ``extractor_key``
info_json_ext info_json_ext
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
The "info.json" extension :type: ``String``
:description:
The "info.json" extension
requested_subtitles requested_subtitles
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
Subtitles if they are requested and exist :type: ``Map``
:description:
Subtitles if they are requested and exist
sponsorblock_chapters sponsorblock_chapters
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Sponsorblock Chapters if they are requested and exist :type: ``Array``
:description:
Sponsorblock Chapters if they are requested and exist
thumbnail_ext thumbnail_ext
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
The download entry's thumbnail extension. Will always return 'jpg'. Until there is a :type: ``String``
need to support other image types, we always convert to jpg. :description:
The download entry's thumbnail extension. Will always return 'jpg'. Until there is a
need to support other image types, we always convert to jpg.
title title
~~~~~ ~~~~~
The title of the entry. If a title does not exist, returns its unique ID. :type: ``String``
:description:
The title of the entry. If a title does not exist, returns its unique ID.
title_sanitized_plex title_sanitized_plex
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The sanitized title with additional sanitizing for Plex. It replaces numbers with :type: ``String``
fixed-width numbers so Plex does not recognize them as season or episode numbers. :description:
The sanitized title with additional sanitizing for Plex. It replaces numbers with
fixed-width numbers so Plex does not recognize them as season or episode numbers.
uid uid
~~~ ~~~
The entry's unique ID :type: ``String``
:description:
The entry's unique ID
uid_sanitized_plex uid_sanitized_plex
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The sanitized uid with additional sanitizing for Plex. Replaces numbers with :type: ``String``
fixed-width numbers so Plex does not recognize them as season or episode numbers. :description:
The sanitized uid with additional sanitizing for Plex. Replaces numbers with
fixed-width numbers so Plex does not recognize them as season or episode numbers.
uploader uploader
~~~~~~~~ ~~~~~~~~
The uploader if it exists, otherwise return the uploader ID. :type: ``String``
:description:
The uploader if it exists, otherwise return the uploader ID.
uploader_id uploader_id
~~~~~~~~~~~ ~~~~~~~~~~~
The uploader id if it exists, otherwise return the unique ID. :type: ``String``
:description:
The uploader id if it exists, otherwise return the unique ID.
uploader_url uploader_url
~~~~~~~~~~~~ ~~~~~~~~~~~~
The uploader url if it exists, otherwise returns the webpage_url. :type: ``String``
:description:
The uploader url if it exists, otherwise returns the webpage_url.
webpage_url webpage_url
~~~~~~~~~~~ ~~~~~~~~~~~
The url to the webpage. :type: ``String``
:description:
The url to the webpage.
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -119,19 +172,27 @@ Metadata Variables
entry_metadata entry_metadata
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
The entry's info.json :type: ``Map``
:description:
The entry's info.json
playlist_metadata playlist_metadata
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Metadata from the playlist (i.e. the parent metadata, like playlist -> entry) :type: ``Map``
:description:
Metadata from the playlist (i.e. the parent metadata, like playlist -> entry)
sibling_metadata sibling_metadata
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
Metadata from any sibling entries that reside in the same playlist as this entry. :type: ``Array``
:description:
Metadata from any sibling entries that reside in the same playlist as this entry.
source_metadata source_metadata
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Metadata from the source (i.e. the grandparent metadata, like channel -> playlist -> entry) :type: ``Map``
:description:
Metadata from the source (i.e. the grandparent metadata, like channel -> playlist -> entry)
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -140,80 +201,114 @@ Playlist Variables
playlist_count playlist_count
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Playlist count if it exists, otherwise returns ``1``. :type: ``Integer``
:description:
Playlist count if it exists, otherwise returns ``1``.
Note that for channels/playlists, any change (i.e. adding or removing a video) will make Note that for channels/playlists, any change (i.e. adding or removing a video) will make
this value change. Use with caution. this value change. Use with caution.
playlist_description playlist_description
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The playlist description if it exists, otherwise returns the entry's description. :type: ``String``
:description:
The playlist description if it exists, otherwise returns the entry's description.
playlist_index playlist_index
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Playlist index if it exists, otherwise returns ``1``. :type: ``Integer``
:description:
Playlist index if it exists, otherwise returns ``1``.
Note that for channels/playlists, any change (i.e. adding or removing a video) will make Note that for channels/playlists, any change (i.e. adding or removing a video) will make
this value change. Use with caution. this value change. Use with caution.
playlist_index_padded playlist_index_padded
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
playlist_index padded two digits :type: ``String``
:description:
playlist_index padded two digits
playlist_index_padded6 playlist_index_padded6
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
playlist_index padded six digits. :type: ``String``
:description:
playlist_index padded six digits.
playlist_index_reversed playlist_index_reversed
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Playlist index reversed via ``playlist_count - playlist_index + 1`` :type: ``Integer``
:description:
Playlist index reversed via ``playlist_count - playlist_index + 1``
playlist_index_reversed_padded playlist_index_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
playlist_index_reversed padded two digits :type: ``String``
:description:
playlist_index_reversed padded two digits
playlist_index_reversed_padded6 playlist_index_reversed_padded6
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
playlist_index_reversed padded six digits. :type: ``String``
:description:
playlist_index_reversed padded six digits.
playlist_max_upload_date playlist_max_upload_date
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
Max upload_date for all entries in this entry's playlist if it exists, otherwise returns :type: ``String``
``upload_date`` :description:
Max upload_date for all entries in this entry's playlist if it exists, otherwise returns
``upload_date``
playlist_max_upload_year playlist_max_upload_year
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
Max upload_year for all entries in this entry's playlist if it exists, otherwise returns :type: ``Integer``
``upload_year`` :description:
Max upload_year for all entries in this entry's playlist if it exists, otherwise returns
``upload_year``
playlist_max_upload_year_truncated playlist_max_upload_year_truncated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The max playlist truncated upload year for all entries in this entry's playlist if it :type: ``Integer``
exists, otherwise returns ``upload_year_truncated``. :description:
The max playlist truncated upload year for all entries in this entry's playlist if it
exists, otherwise returns ``upload_year_truncated``.
playlist_title playlist_title
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Name of its parent playlist/channel if it exists, otherwise returns its title. :type: ``String``
:description:
Name of its parent playlist/channel if it exists, otherwise returns its title.
playlist_uid playlist_uid
~~~~~~~~~~~~ ~~~~~~~~~~~~
The playlist unique ID if it exists, otherwise return the entry unique ID. :type: ``String``
:description:
The playlist unique ID if it exists, otherwise return the entry unique ID.
playlist_uploader playlist_uploader
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
The playlist uploader if it exists, otherwise return the entry uploader. :type: ``String``
:description:
The playlist uploader if it exists, otherwise return the entry uploader.
playlist_uploader_id playlist_uploader_id
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The playlist uploader id if it exists, otherwise returns the entry uploader ID. :type: ``String``
:description:
The playlist uploader id if it exists, otherwise returns the entry uploader ID.
playlist_uploader_url playlist_uploader_url
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
The playlist uploader url if it exists, otherwise returns the playlist webpage_url. :type: ``String``
:description:
The playlist uploader url if it exists, otherwise returns the playlist webpage_url.
playlist_webpage_url playlist_webpage_url
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The playlist webpage url if it exists. Otherwise, returns the entry webpage url. :type: ``String``
:description:
The playlist webpage url if it exists. Otherwise, returns the entry webpage url.
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -222,75 +317,108 @@ Release Date Variables
release_date release_date
~~~~~~~~~~~~ ~~~~~~~~~~~~
The entrys release date, in YYYYMMDD format. If not present, return the upload date. :type: ``String``
:description:
The entrys release date, in YYYYMMDD format. If not present, return the upload date.
release_date_standardized release_date_standardized
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
The release date formatted as YYYY-MM-DD :type: ``String``
:description:
The uploaded date formatted as YYYY-MM-DD
release_day release_day
~~~~~~~~~~~ ~~~~~~~~~~~
The release day as an integer (no padding). :type: ``Integer``
:description:
The upload day as an integer (no padding).
release_day_of_year release_day_of_year
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
The day of the year, i.e. February 1st returns ``32`` :type: ``Integer``
:description:
The day of the year, i.e. February 1st returns ``32``
release_day_of_year_padded release_day_of_year_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
The release day of year, but padded i.e. February 1st returns "032" :type: ``String``
:description:
The upload day of year, but padded i.e. February 1st returns "032"
release_day_of_year_reversed release_day_of_year_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The release day, but reversed using ``{total_days_in_year} + 1 - {release_day}``, :type: ``Integer``
i.e. February 2nd would have release_day_of_year_reversed of ``365 + 1 - 32`` = ``334`` :description:
The upload day, but reversed using ``{total_days_in_year} + 1 - {release_day}``,
i.e. February 2nd would have release_day_of_year_reversed of ``365 + 1 - 32`` = ``334``
release_day_of_year_reversed_padded release_day_of_year_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reversed release day of year, but padded i.e. December 31st returns "001" :type: ``String``
:description:
The reversed upload day of year, but padded i.e. December 31st returns "001"
release_day_padded release_day_padded
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The entry's release day padded to two digits, i.e. the fifth returns "05" :type: ``String``
:description:
The entry's upload day padded to two digits, i.e. the fifth returns "05"
release_day_reversed release_day_reversed
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The release day, but reversed using ``{total_days_in_month} + 1 - {release_day}``, :type: ``Integer``
i.e. August 8th would have release_day_reversed of ``31 + 1 - 8`` = ``24`` :description:
The upload day, but reversed using ``{total_days_in_month} + 1 - {release_day}``,
i.e. August 8th would have release_day_reversed of ``31 + 1 - 8`` = ``24``
release_day_reversed_padded release_day_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reversed release day, but padded. i.e. August 30th returns "02". :type: ``String``
:description:
The reversed upload day, but padded. i.e. August 30th returns "02".
release_month release_month
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
The release month as an integer (no padding). :type: ``Integer``
:description:
The upload month as an integer (no padding).
release_month_padded release_month_padded
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The entry's release month padded to two digits, i.e. March returns "03" :type: ``String``
:description:
The entry's upload month padded to two digits, i.e. March returns "03"
release_month_reversed release_month_reversed
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
The release month, but reversed :type: ``Integer``
using ``13 - {release_month}``, i.e. March returns ``10`` :description:
The upload month, but reversed using ``13 - {release_month}``, i.e. March returns ``10``
release_month_reversed_padded release_month_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reversed release month, but padded. i.e. November returns "02" :type: ``String``
:description:
The reversed upload month, but padded. i.e. November returns "02"
release_year release_year
~~~~~~~~~~~~ ~~~~~~~~~~~~
The entry's release year :type: ``Integer``
:description:
The entry's upload year
release_year_truncated release_year_truncated
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
The last two digits of the release year, i.e. 22 in 2022 :type: ``Integer``
:description:
The last two digits of the upload year, i.e. 22 in 2022
release_year_truncated_reversed release_year_truncated_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The release year truncated, but reversed using ``100 - {release_year_truncated}``, i.e. :type: ``Integer``
2022 returns ``100 - 22`` = ``78`` :description:
The upload year truncated, but reversed using ``100 - {release_year_truncated}``, i.e.
2022 returns ``100 - 22`` = ``78``
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -299,47 +427,67 @@ Source Variables
source_count source_count
~~~~~~~~~~~~ ~~~~~~~~~~~~
The source count if it exists, otherwise returns the playlist count. :type: ``Integer``
:description:
The source count if it exists, otherwise returns ``1``.
source_description source_description
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The source description if it exists, otherwise returns the playlist description. :type: ``String``
:description:
The source description if it exists, otherwise returns the playlist description.
source_index source_index
~~~~~~~~~~~~ ~~~~~~~~~~~~
Source index if it exists, otherwise returns ``1``. :type: ``Integer``
:description:
Source index if it exists, otherwise returns ``1``.
It is recommended to not use this unless you know the source will never add new content It is recommended to not use this unless you know the source will never add new content
(it is easy for this value to change). (it is easy for this value to change).
source_index_padded source_index_padded
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
The source index, padded. :type: ``String``
:description:
The source index, padded two digits.
source_title source_title
~~~~~~~~~~~~ ~~~~~~~~~~~~
Name of the source (i.e. channel with multiple playlists) if it exists, otherwise :type: ``String``
returns its playlist_title. :description:
Name of the source (i.e. channel with multiple playlists) if it exists, otherwise
returns its playlist_title.
source_uid source_uid
~~~~~~~~~~ ~~~~~~~~~~
The source unique id if it exists, otherwise returns the playlist unique ID. :type: ``String``
:description:
The source unique id if it exists, otherwise returns the playlist unique ID.
source_uploader source_uploader
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
The source uploader if it exists, otherwise return the playlist_uploader :type: ``String``
:description:
The source uploader if it exists, otherwise return the playlist_uploader
source_uploader_id source_uploader_id
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The source uploader id if it exists, otherwise returns the playlist_uploader_id :type: ``String``
:description:
The source uploader id if it exists, otherwise returns the playlist_uploader_id
source_uploader_url source_uploader_url
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
The source uploader url if it exists, otherwise returns the source webpage_url. :type: ``String``
:description:
The source uploader url if it exists, otherwise returns the source webpage_url.
source_webpage_url source_webpage_url
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The source webpage url if it exists, otherwise returns the playlist webpage url. :type: ``String``
:description:
The source webpage url if it exists, otherwise returns the playlist webpage url.
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -348,74 +496,108 @@ Upload Date Variables
upload_date upload_date
~~~~~~~~~~~ ~~~~~~~~~~~
The entrys uploaded date, in YYYYMMDD format. If not present, return todays date. :type: ``String``
:description:
The entrys uploaded date, in YYYYMMDD format. If not present, return todays date.
upload_date_standardized upload_date_standardized
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
The uploaded date formatted as YYYY-MM-DD :type: ``String``
:description:
The uploaded date formatted as YYYY-MM-DD
upload_day upload_day
~~~~~~~~~~ ~~~~~~~~~~
The upload day as an integer (no padding). :type: ``Integer``
:description:
The upload day as an integer (no padding).
upload_day_of_year upload_day_of_year
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The day of the year, i.e. February 1st returns ``32`` :type: ``Integer``
:description:
The day of the year, i.e. February 1st returns ``32``
upload_day_of_year_padded upload_day_of_year_padded
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
The upload day of year, but padded i.e. February 1st returns "032" :type: ``String``
:description:
The upload day of year, but padded i.e. February 1st returns "032"
upload_day_of_year_reversed upload_day_of_year_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
The upload day, but reversed using ``{total_days_in_year} + 1 - {upload_day}``, :type: ``Integer``
i.e. February 2nd would have upload_day_of_year_reversed of ``365 + 1 - 32`` = ``334`` :description:
The upload day, but reversed using ``{total_days_in_year} + 1 - {upload_day}``,
i.e. February 2nd would have upload_day_of_year_reversed of ``365 + 1 - 32`` = ``334``
upload_day_of_year_reversed_padded upload_day_of_year_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reversed upload day of year, but padded i.e. December 31st returns "001" :type: ``String``
:description:
The reversed upload day of year, but padded i.e. December 31st returns "001"
upload_day_padded upload_day_padded
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
The entry's upload day padded to two digits, i.e. the fifth returns "05" :type: ``String``
:description:
The entry's upload day padded to two digits, i.e. the fifth returns "05"
upload_day_reversed upload_day_reversed
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
The upload day, but reversed using ``{total_days_in_month} + 1 - {upload_day}``, :type: ``Integer``
i.e. August 8th would have upload_day_reversed of ``31 + 1 - 8`` = ``24`` :description:
The upload day, but reversed using ``{total_days_in_month} + 1 - {upload_day}``,
i.e. August 8th would have upload_day_reversed of ``31 + 1 - 8`` = ``24``
upload_day_reversed_padded upload_day_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
The reversed upload day, but padded. i.e. August 30th returns "02". :type: ``String``
:description:
The reversed upload day, but padded. i.e. August 30th returns "02".
upload_month upload_month
~~~~~~~~~~~~ ~~~~~~~~~~~~
The upload month as an integer (no padding). :type: ``Integer``
:description:
The upload month as an integer (no padding).
upload_month_padded upload_month_padded
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
The entry's upload month padded to two digits, i.e. March returns "03" :type: ``String``
:description:
The entry's upload month padded to two digits, i.e. March returns "03"
upload_month_reversed upload_month_reversed
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
The upload month, but reversed using ``13 - {upload_month}``, i.e. March returns ``10`` :type: ``Integer``
:description:
The upload month, but reversed using ``13 - {upload_month}``, i.e. March returns ``10``
upload_month_reversed_padded upload_month_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reversed upload month, but padded. i.e. November returns "02" :type: ``String``
:description:
The reversed upload month, but padded. i.e. November returns "02"
upload_year upload_year
~~~~~~~~~~~ ~~~~~~~~~~~
The entry's upload year :type: ``Integer``
:description:
The entry's upload year
upload_year_truncated upload_year_truncated
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
The last two digits of the upload year, i.e. 22 in 2022 :type: ``Integer``
:description:
The last two digits of the upload year, i.e. 22 in 2022
upload_year_truncated_reversed upload_year_truncated_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The upload year truncated, but reversed using ``100 - {upload_year_truncated}``, i.e. :type: ``Integer``
2022 returns ``100 - 22`` = ``78`` :description:
The upload year truncated, but reversed using ``100 - {upload_year_truncated}``, i.e.
2022 returns ``100 - 22`` = ``78``
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -424,29 +606,43 @@ Ytdl-Sub Variables
download_index download_index
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
The i'th entry downloaded. NOTE that this is fetched dynamically from the download :type: ``Integer``
archive. :description:
The i'th entry downloaded. NOTE that this is fetched dynamically from the download
archive.
download_index_padded6 download_index_padded6
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
The download_index padded six digits :type: ``String``
:description:
The download_index padded six digits
upload_date_index upload_date_index
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
The i'th entry downloaded with this upload date. :type: ``Integer``
:description:
The i'th entry downloaded with this upload date.
upload_date_index_padded upload_date_index_padded
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
The upload_date_index padded two digits :type: ``String``
:description:
The upload_date_index padded two digits
upload_date_index_reversed upload_date_index_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
100 - upload_date_index :type: ``Integer``
:description:
100 - upload_date_index
upload_date_index_reversed_padded upload_date_index_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The upload_date_index padded two digits :type: ``String``
:description:
The upload_date_index padded two digits
ytdl_sub_input_url ytdl_sub_input_url
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The input URL used in ytdl-sub to create this entry. :type: ``String``
:description:
The input URL used in ytdl-sub to create this entry.

View file

@ -603,7 +603,7 @@ Takes a date in the form of YYYYMMDD and returns a Map containing:
- year (Integer) - year (Integer)
- month (Integer) - month (Integer)
- day (Integer) - day (Integer)
- year_truncated (String, YY from YY[YY]) - year_truncated (Integer, YY from YY[YY])
- month_padded (String) - month_padded (String)
- day_padded (String) - day_padded (String)
- year_truncated_reversed (Integer, 100 - year_truncated) - year_truncated_reversed (Integer, 100 - year_truncated)

View file

@ -27,6 +27,7 @@ class MetadataVariableDefinitions(ABC):
@cached_property @cached_property
def entry_metadata(self: "VariableDefinitions") -> MapVariable: def entry_metadata(self: "VariableDefinitions") -> MapVariable:
""" """
:description:
The entry's info.json The entry's info.json
""" """
return MapVariable(variable_name="entry_metadata", definition="{ {} }") return MapVariable(variable_name="entry_metadata", definition="{ {} }")
@ -34,6 +35,7 @@ class MetadataVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_metadata(self: "VariableDefinitions") -> MapMetadataVariable: def playlist_metadata(self: "VariableDefinitions") -> MapMetadataVariable:
""" """
:description:
Metadata from the playlist (i.e. the parent metadata, like playlist -> entry) Metadata from the playlist (i.e. the parent metadata, like playlist -> entry)
""" """
return MapMetadataVariable.from_entry( return MapMetadataVariable.from_entry(
@ -44,7 +46,9 @@ class MetadataVariableDefinitions(ABC):
@cached_property @cached_property
def source_metadata(self: "VariableDefinitions") -> MapMetadataVariable: def source_metadata(self: "VariableDefinitions") -> MapMetadataVariable:
""" """
Metadata from the source (i.e. the grandparent metadata, like channel -> playlist -> entry) :description:
Metadata from the source
(i.e. the grandparent metadata, like channel -> playlist -> entry)
""" """
return MapMetadataVariable.from_entry( return MapMetadataVariable.from_entry(
metadata_key="source_metadata", metadata_key="source_metadata",
@ -54,6 +58,7 @@ class MetadataVariableDefinitions(ABC):
@cached_property @cached_property
def sibling_metadata(self: "VariableDefinitions") -> ArrayMetadataVariable: def sibling_metadata(self: "VariableDefinitions") -> ArrayMetadataVariable:
""" """
:description:
Metadata from any sibling entries that reside in the same playlist as this entry. Metadata from any sibling entries that reside in the same playlist as this entry.
""" """
return ArrayMetadataVariable.from_entry( return ArrayMetadataVariable.from_entry(
@ -66,6 +71,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_uid(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_uid(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The playlist unique ID if it exists, otherwise return the entry unique ID. The playlist unique ID if it exists, otherwise return the entry unique ID.
""" """
return StringMetadataVariable.from_playlist( return StringMetadataVariable.from_playlist(
@ -75,6 +81,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_title(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_title(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
Name of its parent playlist/channel if it exists, otherwise returns its title. Name of its parent playlist/channel if it exists, otherwise returns its title.
""" """
return StringMetadataVariable.from_playlist( return StringMetadataVariable.from_playlist(
@ -84,6 +91,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_index(self: "VariableDefinitions") -> IntegerMetadataVariable: def playlist_index(self: "VariableDefinitions") -> IntegerMetadataVariable:
""" """
:description:
Playlist index if it exists, otherwise returns ``1``. Playlist index if it exists, otherwise returns ``1``.
Note that for channels/playlists, any change (i.e. adding or removing a video) will make Note that for channels/playlists, any change (i.e. adding or removing a video) will make
@ -94,6 +102,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_index_reversed(self: "VariableDefinitions") -> IntegerVariable: def playlist_index_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
Playlist index reversed via ``playlist_count - playlist_index + 1`` Playlist index reversed via ``playlist_count - playlist_index + 1``
""" """
return IntegerVariable( return IntegerVariable(
@ -110,6 +119,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_index_padded(self: "VariableDefinitions") -> StringVariable: def playlist_index_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
playlist_index padded two digits playlist_index padded two digits
""" """
return self.playlist_index.to_padded_int(variable_name="playlist_index_padded", pad=2) return self.playlist_index.to_padded_int(variable_name="playlist_index_padded", pad=2)
@ -117,6 +127,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_index_reversed_padded(self: "VariableDefinitions") -> StringVariable: def playlist_index_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
playlist_index_reversed padded two digits playlist_index_reversed padded two digits
""" """
return self.playlist_index_reversed.to_padded_int( return self.playlist_index_reversed.to_padded_int(
@ -127,6 +138,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_index_padded6(self: "VariableDefinitions") -> StringVariable: def playlist_index_padded6(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
playlist_index padded six digits. playlist_index padded six digits.
""" """
return self.playlist_index.to_padded_int(variable_name="playlist_index_padded6", pad=6) return self.playlist_index.to_padded_int(variable_name="playlist_index_padded6", pad=6)
@ -134,6 +146,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_index_reversed_padded6(self: "VariableDefinitions") -> StringVariable: def playlist_index_reversed_padded6(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
playlist_index_reversed padded six digits. playlist_index_reversed padded six digits.
""" """
return self.playlist_index_reversed.to_padded_int( return self.playlist_index_reversed.to_padded_int(
@ -143,6 +156,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_count(self: "VariableDefinitions") -> IntegerMetadataVariable: def playlist_count(self: "VariableDefinitions") -> IntegerMetadataVariable:
""" """
:description:
Playlist count if it exists, otherwise returns ``1``. Playlist count if it exists, otherwise returns ``1``.
Note that for channels/playlists, any change (i.e. adding or removing a video) will make Note that for channels/playlists, any change (i.e. adding or removing a video) will make
@ -153,6 +167,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_description(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_description(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The playlist description if it exists, otherwise returns the entry's description. The playlist description if it exists, otherwise returns the entry's description.
""" """
return StringMetadataVariable.from_playlist( return StringMetadataVariable.from_playlist(
@ -164,6 +179,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_webpage_url(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_webpage_url(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The playlist webpage url if it exists. Otherwise, returns the entry webpage url. The playlist webpage url if it exists. Otherwise, returns the entry webpage url.
""" """
return StringMetadataVariable.from_playlist( return StringMetadataVariable.from_playlist(
@ -175,6 +191,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_max_upload_date(self: "VariableDefinitions") -> StringDateVariable: def playlist_max_upload_date(self: "VariableDefinitions") -> StringDateVariable:
""" """
:description:
Max upload_date for all entries in this entry's playlist if it exists, otherwise returns Max upload_date for all entries in this entry's playlist if it exists, otherwise returns
``upload_date`` ``upload_date``
""" """
@ -194,6 +211,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_max_upload_year(self: "VariableDefinitions") -> IntegerVariable: def playlist_max_upload_year(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
Max upload_year for all entries in this entry's playlist if it exists, otherwise returns Max upload_year for all entries in this entry's playlist if it exists, otherwise returns
``upload_year`` ``upload_year``
""" """
@ -205,6 +223,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_max_upload_year_truncated(self: "VariableDefinitions") -> IntegerVariable: def playlist_max_upload_year_truncated(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The max playlist truncated upload year for all entries in this entry's playlist if it The max playlist truncated upload year for all entries in this entry's playlist if it
exists, otherwise returns ``upload_year_truncated``. exists, otherwise returns ``upload_year_truncated``.
""" """
@ -215,6 +234,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_uploader_id(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_uploader_id(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The playlist uploader id if it exists, otherwise returns the entry uploader ID. The playlist uploader id if it exists, otherwise returns the entry uploader ID.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -225,6 +245,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_uploader(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_uploader(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The playlist uploader if it exists, otherwise return the entry uploader. The playlist uploader if it exists, otherwise return the entry uploader.
""" """
return StringMetadataVariable.from_playlist( return StringMetadataVariable.from_playlist(
@ -236,6 +257,7 @@ class PlaylistVariableDefinitions(ABC):
@cached_property @cached_property
def playlist_uploader_url(self: "VariableDefinitions") -> StringMetadataVariable: def playlist_uploader_url(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The playlist uploader url if it exists, otherwise returns the playlist webpage_url. The playlist uploader url if it exists, otherwise returns the playlist webpage_url.
""" """
return StringMetadataVariable.from_playlist( return StringMetadataVariable.from_playlist(
@ -249,6 +271,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_title(self: "VariableDefinitions") -> StringMetadataVariable: def source_title(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
Name of the source (i.e. channel with multiple playlists) if it exists, otherwise Name of the source (i.e. channel with multiple playlists) if it exists, otherwise
returns its playlist_title. returns its playlist_title.
""" """
@ -261,6 +284,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_uid(self: "VariableDefinitions") -> StringMetadataVariable: def source_uid(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The source unique id if it exists, otherwise returns the playlist unique ID. The source unique id if it exists, otherwise returns the playlist unique ID.
""" """
return StringMetadataVariable.from_source( return StringMetadataVariable.from_source(
@ -272,6 +296,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_index(self: "VariableDefinitions") -> IntegerMetadataVariable: def source_index(self: "VariableDefinitions") -> IntegerMetadataVariable:
""" """
:description:
Source index if it exists, otherwise returns ``1``. Source index if it exists, otherwise returns ``1``.
It is recommended to not use this unless you know the source will never add new content It is recommended to not use this unless you know the source will never add new content
@ -286,6 +311,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_index_padded(self: "VariableDefinitions") -> StringVariable: def source_index_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The source index, padded two digits. The source index, padded two digits.
""" """
return self.source_index.to_padded_int(variable_name="source_index_padded", pad=2) return self.source_index.to_padded_int(variable_name="source_index_padded", pad=2)
@ -293,6 +319,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_count(self: "VariableDefinitions") -> IntegerMetadataVariable: def source_count(self: "VariableDefinitions") -> IntegerMetadataVariable:
""" """
:description:
The source count if it exists, otherwise returns ``1``. The source count if it exists, otherwise returns ``1``.
""" """
return IntegerMetadataVariable.from_playlist( return IntegerMetadataVariable.from_playlist(
@ -304,6 +331,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_webpage_url(self: "VariableDefinitions") -> StringMetadataVariable: def source_webpage_url(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The source webpage url if it exists, otherwise returns the playlist webpage url. The source webpage url if it exists, otherwise returns the playlist webpage url.
""" """
return StringMetadataVariable.from_source( return StringMetadataVariable.from_source(
@ -315,6 +343,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_description(self: "VariableDefinitions") -> StringMetadataVariable: def source_description(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The source description if it exists, otherwise returns the playlist description. The source description if it exists, otherwise returns the playlist description.
""" """
return StringMetadataVariable.from_source( return StringMetadataVariable.from_source(
@ -326,6 +355,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_uploader_id(self: "VariableDefinitions") -> StringMetadataVariable: def source_uploader_id(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The source uploader id if it exists, otherwise returns the playlist_uploader_id The source uploader id if it exists, otherwise returns the playlist_uploader_id
""" """
return StringMetadataVariable.from_source( return StringMetadataVariable.from_source(
@ -337,6 +367,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_uploader(self: "VariableDefinitions") -> StringMetadataVariable: def source_uploader(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The source uploader if it exists, otherwise return the playlist_uploader The source uploader if it exists, otherwise return the playlist_uploader
""" """
return StringMetadataVariable.from_source( return StringMetadataVariable.from_source(
@ -348,6 +379,7 @@ class SourceVariableDefinitions(ABC):
@cached_property @cached_property
def source_uploader_url(self: "VariableDefinitions") -> StringMetadataVariable: def source_uploader_url(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The source uploader url if it exists, otherwise returns the source webpage_url. The source uploader url if it exists, otherwise returns the source webpage_url.
""" """
return StringMetadataVariable.from_source( return StringMetadataVariable.from_source(
@ -361,6 +393,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_date(self: "VariableDefinitions") -> StringDateMetadataVariable: def upload_date(self: "VariableDefinitions") -> StringDateMetadataVariable:
""" """
:description:
The entrys uploaded date, in YYYYMMDD format. If not present, return todays date. The entrys uploaded date, in YYYYMMDD format. If not present, return todays date.
""" """
return StringDateMetadataVariable.from_entry(metadata_key="upload_date").as_date_variable() return StringDateMetadataVariable.from_entry(metadata_key="upload_date").as_date_variable()
@ -368,6 +401,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_year(self: "VariableDefinitions") -> IntegerVariable: def upload_year(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The entry's upload year The entry's upload year
""" """
return self.upload_date.get_integer_date_metadata( return self.upload_date.get_integer_date_metadata(
@ -377,6 +411,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_year_truncated(self: "VariableDefinitions") -> IntegerVariable: def upload_year_truncated(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The last two digits of the upload year, i.e. 22 in 2022 The last two digits of the upload year, i.e. 22 in 2022
""" """
return self.upload_date.get_integer_date_metadata( return self.upload_date.get_integer_date_metadata(
@ -386,6 +421,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_year_truncated_reversed(self: "VariableDefinitions") -> IntegerVariable: def upload_year_truncated_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload year truncated, but reversed using ``100 - {upload_year_truncated}``, i.e. The upload year truncated, but reversed using ``100 - {upload_year_truncated}``, i.e.
2022 returns ``100 - 22`` = ``78`` 2022 returns ``100 - 22`` = ``78``
""" """
@ -397,6 +433,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_month_reversed(self: "VariableDefinitions") -> IntegerVariable: def upload_month_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload month, but reversed using ``13 - {upload_month}``, i.e. March returns ``10`` The upload month, but reversed using ``13 - {upload_month}``, i.e. March returns ``10``
""" """
return self.upload_date.get_integer_date_metadata( return self.upload_date.get_integer_date_metadata(
@ -406,6 +443,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_month_reversed_padded(self: "VariableDefinitions") -> StringVariable: def upload_month_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The reversed upload month, but padded. i.e. November returns "02" The reversed upload month, but padded. i.e. November returns "02"
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -415,6 +453,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_month_padded(self: "VariableDefinitions") -> StringVariable: def upload_month_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The entry's upload month padded to two digits, i.e. March returns "03" The entry's upload month padded to two digits, i.e. March returns "03"
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -424,6 +463,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_padded(self: "VariableDefinitions") -> StringVariable: def upload_day_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The entry's upload day padded to two digits, i.e. the fifth returns "05" The entry's upload day padded to two digits, i.e. the fifth returns "05"
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -433,6 +473,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_month(self: "VariableDefinitions") -> IntegerVariable: def upload_month(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload month as an integer (no padding). The upload month as an integer (no padding).
""" """
return self.upload_date.get_integer_date_metadata( return self.upload_date.get_integer_date_metadata(
@ -442,6 +483,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day(self: "VariableDefinitions") -> IntegerVariable: def upload_day(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload day as an integer (no padding). The upload day as an integer (no padding).
""" """
return self.upload_date.get_integer_date_metadata( return self.upload_date.get_integer_date_metadata(
@ -451,6 +493,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_reversed(self: "VariableDefinitions") -> IntegerVariable: def upload_day_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload day, but reversed using ``{total_days_in_month} + 1 - {upload_day}``, The upload day, but reversed using ``{total_days_in_month} + 1 - {upload_day}``,
i.e. August 8th would have upload_day_reversed of ``31 + 1 - 8`` = ``24`` i.e. August 8th would have upload_day_reversed of ``31 + 1 - 8`` = ``24``
""" """
@ -461,6 +504,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_reversed_padded(self: "VariableDefinitions") -> StringVariable: def upload_day_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The reversed upload day, but padded. i.e. August 30th returns "02". The reversed upload day, but padded. i.e. August 30th returns "02".
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -470,6 +514,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_of_year(self: "VariableDefinitions") -> IntegerVariable: def upload_day_of_year(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The day of the year, i.e. February 1st returns ``32`` The day of the year, i.e. February 1st returns ``32``
""" """
return self.upload_date.get_integer_date_metadata( return self.upload_date.get_integer_date_metadata(
@ -479,6 +524,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_of_year_padded(self: "VariableDefinitions") -> StringVariable: def upload_day_of_year_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The upload day of year, but padded i.e. February 1st returns "032" The upload day of year, but padded i.e. February 1st returns "032"
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -488,6 +534,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_of_year_reversed(self: "VariableDefinitions") -> IntegerVariable: def upload_day_of_year_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload day, but reversed using ``{total_days_in_year} + 1 - {upload_day}``, The upload day, but reversed using ``{total_days_in_year} + 1 - {upload_day}``,
i.e. February 2nd would have upload_day_of_year_reversed of ``365 + 1 - 32`` = ``334`` i.e. February 2nd would have upload_day_of_year_reversed of ``365 + 1 - 32`` = ``334``
""" """
@ -498,6 +545,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_day_of_year_reversed_padded(self: "VariableDefinitions") -> StringVariable: def upload_day_of_year_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The reversed upload day of year, but padded i.e. December 31st returns "001" The reversed upload day of year, but padded i.e. December 31st returns "001"
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -508,6 +556,7 @@ class UploadDateVariableDefinitions(ABC):
@cached_property @cached_property
def upload_date_standardized(self: "VariableDefinitions") -> StringVariable: def upload_date_standardized(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The uploaded date formatted as YYYY-MM-DD The uploaded date formatted as YYYY-MM-DD
""" """
return self.upload_date.get_string_date_metadata( return self.upload_date.get_string_date_metadata(
@ -519,6 +568,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_date(self: "VariableDefinitions") -> StringDateMetadataVariable: def release_date(self: "VariableDefinitions") -> StringDateMetadataVariable:
""" """
:description:
The entrys release date, in YYYYMMDD format. If not present, return the upload date. The entrys release date, in YYYYMMDD format. If not present, return the upload date.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -528,6 +578,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_year(self: "VariableDefinitions") -> IntegerVariable: def release_year(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The entry's upload year The entry's upload year
""" """
return self.release_date.get_integer_date_metadata( return self.release_date.get_integer_date_metadata(
@ -537,6 +588,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_year_truncated(self: "VariableDefinitions") -> IntegerVariable: def release_year_truncated(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The last two digits of the upload year, i.e. 22 in 2022 The last two digits of the upload year, i.e. 22 in 2022
""" """
return self.release_date.get_integer_date_metadata( return self.release_date.get_integer_date_metadata(
@ -546,6 +598,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_year_truncated_reversed(self: "VariableDefinitions") -> IntegerVariable: def release_year_truncated_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload year truncated, but reversed using ``100 - {release_year_truncated}``, i.e. The upload year truncated, but reversed using ``100 - {release_year_truncated}``, i.e.
2022 returns ``100 - 22`` = ``78`` 2022 returns ``100 - 22`` = ``78``
""" """
@ -557,6 +610,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_month_reversed(self: "VariableDefinitions") -> IntegerVariable: def release_month_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload month, but reversed using ``13 - {release_month}``, i.e. March returns ``10`` The upload month, but reversed using ``13 - {release_month}``, i.e. March returns ``10``
""" """
return self.release_date.get_integer_date_metadata( return self.release_date.get_integer_date_metadata(
@ -566,6 +620,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_month_reversed_padded(self: "VariableDefinitions") -> StringVariable: def release_month_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The reversed upload month, but padded. i.e. November returns "02" The reversed upload month, but padded. i.e. November returns "02"
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -575,6 +630,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_month_padded(self: "VariableDefinitions") -> StringVariable: def release_month_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The entry's upload month padded to two digits, i.e. March returns "03" The entry's upload month padded to two digits, i.e. March returns "03"
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -584,6 +640,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_padded(self: "VariableDefinitions") -> StringVariable: def release_day_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The entry's upload day padded to two digits, i.e. the fifth returns "05" The entry's upload day padded to two digits, i.e. the fifth returns "05"
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -593,6 +650,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_month(self: "VariableDefinitions") -> IntegerVariable: def release_month(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload month as an integer (no padding). The upload month as an integer (no padding).
""" """
return self.release_date.get_integer_date_metadata( return self.release_date.get_integer_date_metadata(
@ -602,6 +660,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day(self: "VariableDefinitions") -> IntegerVariable: def release_day(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload day as an integer (no padding). The upload day as an integer (no padding).
""" """
return self.release_date.get_integer_date_metadata( return self.release_date.get_integer_date_metadata(
@ -611,6 +670,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_reversed(self: "VariableDefinitions") -> IntegerVariable: def release_day_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload day, but reversed using ``{total_days_in_month} + 1 - {release_day}``, The upload day, but reversed using ``{total_days_in_month} + 1 - {release_day}``,
i.e. August 8th would have release_day_reversed of ``31 + 1 - 8`` = ``24`` i.e. August 8th would have release_day_reversed of ``31 + 1 - 8`` = ``24``
""" """
@ -621,6 +681,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_reversed_padded(self: "VariableDefinitions") -> StringVariable: def release_day_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The reversed upload day, but padded. i.e. August 30th returns "02". The reversed upload day, but padded. i.e. August 30th returns "02".
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -630,6 +691,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_of_year(self: "VariableDefinitions") -> IntegerVariable: def release_day_of_year(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The day of the year, i.e. February 1st returns ``32`` The day of the year, i.e. February 1st returns ``32``
""" """
return self.release_date.get_integer_date_metadata( return self.release_date.get_integer_date_metadata(
@ -639,6 +701,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_of_year_padded(self: "VariableDefinitions") -> StringVariable: def release_day_of_year_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The upload day of year, but padded i.e. February 1st returns "032" The upload day of year, but padded i.e. February 1st returns "032"
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -648,6 +711,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_of_year_reversed(self: "VariableDefinitions") -> IntegerVariable: def release_day_of_year_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The upload day, but reversed using ``{total_days_in_year} + 1 - {release_day}``, The upload day, but reversed using ``{total_days_in_year} + 1 - {release_day}``,
i.e. February 2nd would have release_day_of_year_reversed of ``365 + 1 - 32`` = ``334`` i.e. February 2nd would have release_day_of_year_reversed of ``365 + 1 - 32`` = ``334``
""" """
@ -658,6 +722,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_day_of_year_reversed_padded(self: "VariableDefinitions") -> StringVariable: def release_day_of_year_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The reversed upload day of year, but padded i.e. December 31st returns "001" The reversed upload day of year, but padded i.e. December 31st returns "001"
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -668,6 +733,7 @@ class ReleaseDateVariableDefinitions(ABC):
@cached_property @cached_property
def release_date_standardized(self: "VariableDefinitions") -> StringVariable: def release_date_standardized(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The uploaded date formatted as YYYY-MM-DD The uploaded date formatted as YYYY-MM-DD
""" """
return self.release_date.get_string_date_metadata( return self.release_date.get_string_date_metadata(
@ -679,6 +745,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def ytdl_sub_input_url(self: "VariableDefinitions") -> StringVariable: def ytdl_sub_input_url(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The input URL used in ytdl-sub to create this entry. The input URL used in ytdl-sub to create this entry.
""" """
return StringVariable(variable_name="ytdl_sub_input_url", definition="{ %string('') }") return StringVariable(variable_name="ytdl_sub_input_url", definition="{ %string('') }")
@ -686,6 +753,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def download_index(self: "VariableDefinitions") -> IntegerVariable: def download_index(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The i'th entry downloaded. NOTE that this is fetched dynamically from the download The i'th entry downloaded. NOTE that this is fetched dynamically from the download
archive. archive.
""" """
@ -694,6 +762,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def download_index_padded6(self: "VariableDefinitions") -> StringVariable: def download_index_padded6(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The download_index padded six digits The download_index padded six digits
""" """
return self.download_index.to_padded_int(variable_name="download_index_padded6", pad=6) return self.download_index.to_padded_int(variable_name="download_index_padded6", pad=6)
@ -701,6 +770,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def upload_date_index(self: "VariableDefinitions") -> IntegerVariable: def upload_date_index(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
The i'th entry downloaded with this upload date. The i'th entry downloaded with this upload date.
""" """
return IntegerVariable(variable_name="upload_date_index", definition="{ %int(1) }") return IntegerVariable(variable_name="upload_date_index", definition="{ %int(1) }")
@ -708,6 +778,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def upload_date_index_padded(self: "VariableDefinitions") -> StringVariable: def upload_date_index_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The upload_date_index padded two digits The upload_date_index padded two digits
""" """
return self.upload_date_index.to_padded_int(variable_name="upload_date_index_padded", pad=2) return self.upload_date_index.to_padded_int(variable_name="upload_date_index_padded", pad=2)
@ -715,6 +786,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def upload_date_index_reversed(self: "VariableDefinitions") -> IntegerVariable: def upload_date_index_reversed(self: "VariableDefinitions") -> IntegerVariable:
""" """
:description:
100 - upload_date_index 100 - upload_date_index
""" """
return IntegerVariable( return IntegerVariable(
@ -725,6 +797,7 @@ class YtdlSubVariableDefinitions(ABC):
@cached_property @cached_property
def upload_date_index_reversed_padded(self: "VariableDefinitions") -> StringVariable: def upload_date_index_reversed_padded(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The upload_date_index padded two digits The upload_date_index padded two digits
""" """
return self.upload_date_index_reversed.to_padded_int( return self.upload_date_index_reversed.to_padded_int(
@ -736,6 +809,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def uid(self: "VariableDefinitions") -> StringMetadataVariable: def uid(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The entry's unique ID The entry's unique ID
""" """
return StringMetadataVariable.from_entry(metadata_key="id", variable_name="uid") return StringMetadataVariable.from_entry(metadata_key="id", variable_name="uid")
@ -743,6 +817,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def duration(self: "VariableDefinitions") -> IntegerMetadataVariable: def duration(self: "VariableDefinitions") -> IntegerMetadataVariable:
""" """
:description:
The duration of the entry in seconds if it exists. Defaults to zero otherwise. The duration of the entry in seconds if it exists. Defaults to zero otherwise.
""" """
return IntegerMetadataVariable.from_entry(metadata_key="duration", default=0) return IntegerMetadataVariable.from_entry(metadata_key="duration", default=0)
@ -750,6 +825,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def uid_sanitized_plex(self: "VariableDefinitions") -> StringVariable: def uid_sanitized_plex(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The sanitized uid with additional sanitizing for Plex. Replaces numbers with The sanitized uid with additional sanitizing for Plex. Replaces numbers with
fixed-width numbers so Plex does not recognize them as season or episode numbers. fixed-width numbers so Plex does not recognize them as season or episode numbers.
""" """
@ -758,6 +834,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def ie_key(self: "VariableDefinitions") -> StringMetadataVariable: def ie_key(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The ie_key, used in legacy yt-dlp things as the 'info-extractor key'. The ie_key, used in legacy yt-dlp things as the 'info-extractor key'.
If it does not exist, return ``extractor_key`` If it does not exist, return ``extractor_key``
""" """
@ -766,6 +843,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def extractor_key(self: "VariableDefinitions") -> StringMetadataVariable: def extractor_key(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The yt-dlp extractor key The yt-dlp extractor key
""" """
return StringMetadataVariable.from_entry(metadata_key="extractor_key") return StringMetadataVariable.from_entry(metadata_key="extractor_key")
@ -773,6 +851,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def extractor(self: "VariableDefinitions") -> StringMetadataVariable: def extractor(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The yt-dlp extractor name The yt-dlp extractor name
""" """
return StringMetadataVariable.from_entry(metadata_key="extractor") return StringMetadataVariable.from_entry(metadata_key="extractor")
@ -780,6 +859,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def epoch(self: "VariableDefinitions") -> IntegerMetadataVariable: def epoch(self: "VariableDefinitions") -> IntegerMetadataVariable:
""" """
:description:
The unix epoch of when the metadata was scraped by yt-dlp. The unix epoch of when the metadata was scraped by yt-dlp.
""" """
return IntegerMetadataVariable.from_entry(metadata_key="epoch") return IntegerMetadataVariable.from_entry(metadata_key="epoch")
@ -787,6 +867,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def epoch_date(self: "VariableDefinitions") -> StringVariable: def epoch_date(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The epoch's date, in YYYYMMDD format. The epoch's date, in YYYYMMDD format.
""" """
return StringVariable( return StringVariable(
@ -797,6 +878,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def epoch_hour(self: "VariableDefinitions") -> StringVariable: def epoch_hour(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The epoch's hour The epoch's hour
""" """
return StringVariable( return StringVariable(
@ -807,6 +889,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def title(self: "VariableDefinitions") -> StringMetadataVariable: def title(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The title of the entry. If a title does not exist, returns its unique ID. The title of the entry. If a title does not exist, returns its unique ID.
""" """
return StringMetadataVariable.from_entry(metadata_key="title", default=self.uid) return StringMetadataVariable.from_entry(metadata_key="title", default=self.uid)
@ -814,6 +897,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def title_sanitized_plex(self: "VariableDefinitions") -> StringVariable: def title_sanitized_plex(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The sanitized title with additional sanitizing for Plex. It replaces numbers with The sanitized title with additional sanitizing for Plex. It replaces numbers with
fixed-width numbers so Plex does not recognize them as season or episode numbers. fixed-width numbers so Plex does not recognize them as season or episode numbers.
""" """
@ -822,6 +906,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def webpage_url(self: "VariableDefinitions") -> StringMetadataVariable: def webpage_url(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The url to the webpage. The url to the webpage.
""" """
return StringMetadataVariable.from_entry(metadata_key="webpage_url") return StringMetadataVariable.from_entry(metadata_key="webpage_url")
@ -829,6 +914,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def info_json_ext(self: "VariableDefinitions") -> StringVariable: def info_json_ext(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The "info.json" extension The "info.json" extension
""" """
return StringVariable( return StringVariable(
@ -839,6 +925,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def description(self: "VariableDefinitions") -> StringMetadataVariable: def description(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The description if it exists. Otherwise, returns an emtpy string. The description if it exists. Otherwise, returns an emtpy string.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -849,6 +936,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def uploader_id(self: "VariableDefinitions") -> StringMetadataVariable: def uploader_id(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The uploader id if it exists, otherwise return the unique ID. The uploader id if it exists, otherwise return the unique ID.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -859,6 +947,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def uploader(self: "VariableDefinitions") -> StringMetadataVariable: def uploader(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The uploader if it exists, otherwise return the uploader ID. The uploader if it exists, otherwise return the uploader ID.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -869,6 +958,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def uploader_url(self: "VariableDefinitions") -> StringMetadataVariable: def uploader_url(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The uploader url if it exists, otherwise returns the webpage_url. The uploader url if it exists, otherwise returns the webpage_url.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -879,6 +969,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def creator(self: "VariableDefinitions") -> StringMetadataVariable: def creator(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The creator name if it exists, otherwise returns the channel. The creator name if it exists, otherwise returns the channel.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -889,6 +980,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def channel(self: "VariableDefinitions") -> StringMetadataVariable: def channel(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The channel name if it exists, otherwise returns the uploader. The channel name if it exists, otherwise returns the uploader.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -899,6 +991,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def channel_id(self: "VariableDefinitions") -> StringMetadataVariable: def channel_id(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The channel id if it exists, otherwise returns the entry uploader ID. The channel id if it exists, otherwise returns the entry uploader ID.
""" """
return StringMetadataVariable.from_entry( return StringMetadataVariable.from_entry(
@ -909,6 +1002,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def ext(self: "VariableDefinitions") -> StringMetadataVariable: def ext(self: "VariableDefinitions") -> StringMetadataVariable:
""" """
:description:
The downloaded entry's file extension The downloaded entry's file extension
""" """
return StringMetadataVariable.from_entry(metadata_key="ext") return StringMetadataVariable.from_entry(metadata_key="ext")
@ -916,6 +1010,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def thumbnail_ext(self: "VariableDefinitions") -> StringVariable: def thumbnail_ext(self: "VariableDefinitions") -> StringVariable:
""" """
:description:
The download entry's thumbnail extension. Will always return 'jpg'. Until there is a The download entry's thumbnail extension. Will always return 'jpg'. Until there is a
need to support other image types, we always convert to jpg. need to support other image types, we always convert to jpg.
""" """
@ -927,6 +1022,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def comments(self: "VariableDefinitions") -> ArrayMetadataVariable: def comments(self: "VariableDefinitions") -> ArrayMetadataVariable:
""" """
:description:
Comments if they are requested Comments if they are requested
""" """
return ArrayMetadataVariable( return ArrayMetadataVariable(
@ -936,6 +1032,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def chapters(self: "VariableDefinitions") -> ArrayMetadataVariable: def chapters(self: "VariableDefinitions") -> ArrayMetadataVariable:
""" """
:description:
Chapters if they exist Chapters if they exist
""" """
return ArrayMetadataVariable( return ArrayMetadataVariable(
@ -945,6 +1042,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def sponsorblock_chapters(self: "VariableDefinitions") -> ArrayMetadataVariable: def sponsorblock_chapters(self: "VariableDefinitions") -> ArrayMetadataVariable:
""" """
:description:
Sponsorblock Chapters if they are requested and exist Sponsorblock Chapters if they are requested and exist
""" """
return ArrayMetadataVariable( return ArrayMetadataVariable(
@ -956,6 +1054,7 @@ class EntryVariableDefinitions(ABC):
@cached_property @cached_property
def requested_subtitles(self: "VariableDefinitions") -> MapMetadataVariable: def requested_subtitles(self: "VariableDefinitions") -> MapMetadataVariable:
""" """
:description:
Subtitles if they are requested and exist Subtitles if they are requested and exist
""" """
return MapMetadataVariable( return MapMetadataVariable(

View file

@ -4,11 +4,12 @@ from typing import Dict
from typing import Type from typing import Type
from tools.docgen.docgen import DocGen from tools.docgen.docgen import DocGen
from tools.docgen.utils import cached_properties
from tools.docgen.utils import camel_case_to_human from tools.docgen.utils import camel_case_to_human
from tools.docgen.utils import get_function_docs from tools.docgen.utils import get_function_docs
from tools.docgen.utils import line_section from tools.docgen.utils import line_section
from tools.docgen.utils import properties
from tools.docgen.utils import section from tools.docgen.utils import section
from ytdl_sub.entries.script.variable_definitions import VARIABLES
from ytdl_sub.entries.script.variable_definitions import VariableDefinitions from ytdl_sub.entries.script.variable_definitions import VariableDefinitions
@ -37,10 +38,11 @@ class EntryVariablesDocGen(DocGen):
docs += line_section(section_idx=idx) docs += line_section(section_idx=idx)
docs += section(name, level=1) docs += section(name, level=1)
for variable_function_name in properties(parent_objs[name]): for variable_function_name in cached_properties(parent_objs[name]):
docs += get_function_docs( docs += get_function_docs(
function_name=variable_function_name, function_name=variable_function_name,
obj=parent_objs[name], obj=parent_objs[name],
pre_docstring=f":type: ``{getattr(VARIABLES, variable_function_name).human_readable_type()}``\n",
level=2, level=2,
) )

View file

@ -1,4 +1,5 @@
import inspect import inspect
from functools import cached_property
from typing import Any from typing import Any
from typing import Dict from typing import Dict
from typing import List from typing import List
@ -18,6 +19,10 @@ def properties(obj: Type[Any]) -> List[str]:
return sorted(prop for prop in dir(obj) if isinstance(getattr(obj, prop), property)) return sorted(prop for prop in dir(obj) if isinstance(getattr(obj, prop), property))
def cached_properties(obj: Type[Any]) -> List[str]:
return sorted(prop for prop in dir(obj) if isinstance(getattr(obj, prop), cached_property))
def static_methods(obj: Type[Any]) -> List[str]: def static_methods(obj: Type[Any]) -> List[str]:
return sorted( return sorted(
name for name in dir(obj) if isinstance(inspect.getattr_static(obj, name), staticmethod) name for name in dir(obj) if isinstance(inspect.getattr_static(obj, name), staticmethod)
@ -36,11 +41,16 @@ def camel_case_to_human(string: str) -> str:
def get_function_docs( def get_function_docs(
function_name: str, obj: Any, level: int, display_function_name: Optional[str] = None function_name: str,
obj: Any,
level: int,
display_function_name: Optional[str] = None,
pre_docstring: Optional[str] = None,
) -> str: ) -> str:
display_function_name = display_function_name if display_function_name else function_name display_function_name = display_function_name if display_function_name else function_name
docs = section(display_function_name, level=level) docs = section(display_function_name, level=level)
docs += pre_docstring or ""
docs += inspect.cleandoc(getattr(obj, function_name).__doc__) docs += inspect.cleandoc(getattr(obj, function_name).__doc__)
docs += "\n" docs += "\n"
return docs return docs