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,109 +7,162 @@ Entry Variables
channel
~~~~~~~
:type: ``String``
:description:
The channel name if it exists, otherwise returns the uploader.
channel_id
~~~~~~~~~~
:type: ``String``
:description:
The channel id if it exists, otherwise returns the entry uploader ID.
chapters
~~~~~~~~
:type: ``Array``
:description:
Chapters if they exist
comments
~~~~~~~~
:type: ``Array``
:description:
Comments if they are requested
creator
~~~~~~~
:type: ``String``
:description:
The creator name if it exists, otherwise returns the channel.
description
~~~~~~~~~~~
:type: ``String``
:description:
The description if it exists. Otherwise, returns an emtpy string.
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
~~~~~
:type: ``Integer``
:description:
The unix epoch of when the metadata was scraped by yt-dlp.
epoch_date
~~~~~~~~~~
:type: ``String``
:description:
The epoch's date, in YYYYMMDD format.
epoch_hour
~~~~~~~~~~
:type: ``String``
:description:
The epoch's hour
ext
~~~
:type: ``String``
:description:
The downloaded entry's file extension
extractor
~~~~~~~~~
:type: ``String``
:description:
The yt-dlp extractor name
extractor_key
~~~~~~~~~~~~~
:type: ``String``
:description:
The yt-dlp extractor 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
~~~~~~~~~~~~~
:type: ``String``
:description:
The "info.json" extension
requested_subtitles
~~~~~~~~~~~~~~~~~~~
:type: ``Map``
:description:
Subtitles if they are requested and exist
sponsorblock_chapters
~~~~~~~~~~~~~~~~~~~~~
:type: ``Array``
:description:
Sponsorblock Chapters if they are requested and exist
thumbnail_ext
~~~~~~~~~~~~~
:type: ``String``
: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
~~~~~
:type: ``String``
:description:
The title of the entry. If a title does not exist, returns its unique ID.
title_sanitized_plex
~~~~~~~~~~~~~~~~~~~~
:type: ``String``
: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
~~~
:type: ``String``
:description:
The entry's unique ID
uid_sanitized_plex
~~~~~~~~~~~~~~~~~~
:type: ``String``
: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
~~~~~~~~
:type: ``String``
:description:
The uploader if it exists, otherwise return the uploader ID.
uploader_id
~~~~~~~~~~~
:type: ``String``
:description:
The uploader id if it exists, otherwise return the unique ID.
uploader_url
~~~~~~~~~~~~
:type: ``String``
:description:
The uploader url if it exists, otherwise returns the webpage_url.
webpage_url
~~~~~~~~~~~
:type: ``String``
:description:
The url to the webpage.
----------------------------------------------------------------------------------------------------
@ -119,18 +172,26 @@ Metadata Variables
entry_metadata
~~~~~~~~~~~~~~
:type: ``Map``
:description:
The entry's info.json
playlist_metadata
~~~~~~~~~~~~~~~~~
:type: ``Map``
:description:
Metadata from the playlist (i.e. the parent metadata, like playlist -> entry)
sibling_metadata
~~~~~~~~~~~~~~~~
:type: ``Array``
:description:
Metadata from any sibling entries that reside in the same playlist as this entry.
source_metadata
~~~~~~~~~~~~~~~
:type: ``Map``
:description:
Metadata from the source (i.e. the grandparent metadata, like channel -> playlist -> entry)
----------------------------------------------------------------------------------------------------
@ -140,6 +201,8 @@ Playlist Variables
playlist_count
~~~~~~~~~~~~~~
: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
@ -147,10 +210,14 @@ this value change. Use with caution.
playlist_description
~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The playlist description if it exists, otherwise returns the entry's description.
playlist_index
~~~~~~~~~~~~~~
: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
@ -158,61 +225,89 @@ this value change. Use with caution.
playlist_index_padded
~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
playlist_index padded two digits
playlist_index_padded6
~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
playlist_index padded six digits.
playlist_index_reversed
~~~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
Playlist index reversed via ``playlist_count - playlist_index + 1``
playlist_index_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
playlist_index_reversed padded two digits
playlist_index_reversed_padded6
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
playlist_index_reversed padded six digits.
playlist_max_upload_date
~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
Max upload_date for all entries in this entry's playlist if it exists, otherwise returns
``upload_date``
playlist_max_upload_year
~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
Max upload_year for all entries in this entry's playlist if it exists, otherwise returns
``upload_year``
playlist_max_upload_year_truncated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
: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
~~~~~~~~~~~~~~
:type: ``String``
:description:
Name of its parent playlist/channel if it exists, otherwise returns its title.
playlist_uid
~~~~~~~~~~~~
:type: ``String``
:description:
The playlist unique ID if it exists, otherwise return the entry unique ID.
playlist_uploader
~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The playlist uploader if it exists, otherwise return the entry uploader.
playlist_uploader_id
~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The playlist uploader id if it exists, otherwise returns the entry uploader ID.
playlist_uploader_url
~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The playlist uploader url if it exists, otherwise returns the playlist webpage_url.
playlist_webpage_url
~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The playlist webpage url if it exists. Otherwise, returns the entry webpage url.
----------------------------------------------------------------------------------------------------
@ -222,74 +317,107 @@ Release Date Variables
release_date
~~~~~~~~~~~~
:type: ``String``
:description:
The entrys release date, in YYYYMMDD format. If not present, return the upload date.
release_date_standardized
~~~~~~~~~~~~~~~~~~~~~~~~~
The release date formatted as YYYY-MM-DD
:type: ``String``
:description:
The uploaded date formatted as YYYY-MM-DD
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
~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
The day of the year, i.e. February 1st returns ``32``
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The release day, but reversed using ``{total_days_in_year} + 1 - {release_day}``,
:type: ``Integer``
: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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
~~~~~~~~~~~~~~~~~~
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
~~~~~~~~~~~~~~~~~~~~
The release day, but reversed using ``{total_days_in_month} + 1 - {release_day}``,
:type: ``Integer``
: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
~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
~~~~~~~~~~~~~
The release month as an integer (no padding).
:type: ``Integer``
:description:
The upload month as an integer (no padding).
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
~~~~~~~~~~~~~~~~~~~~~~
The release month, but reversed
using ``13 - {release_month}``, i.e. March returns ``10``
:type: ``Integer``
:description:
The upload month, but reversed using ``13 - {release_month}``, i.e. March returns ``10``
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
~~~~~~~~~~~~
The entry's release year
:type: ``Integer``
:description:
The entry's upload year
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The release year truncated, but reversed using ``100 - {release_year_truncated}``, i.e.
:type: ``Integer``
:description:
The upload year truncated, but reversed using ``100 - {release_year_truncated}``, i.e.
2022 returns ``100 - 22`` = ``78``
----------------------------------------------------------------------------------------------------
@ -299,14 +427,20 @@ Source Variables
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
~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The source description if it exists, otherwise returns the playlist description.
source_index
~~~~~~~~~~~~
: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
@ -314,31 +448,45 @@ It is recommended to not use this unless you know the source will never add new
source_index_padded
~~~~~~~~~~~~~~~~~~~
The source index, padded.
:type: ``String``
:description:
The source index, padded two digits.
source_title
~~~~~~~~~~~~
:type: ``String``
:description:
Name of the source (i.e. channel with multiple playlists) if it exists, otherwise
returns its playlist_title.
source_uid
~~~~~~~~~~
:type: ``String``
:description:
The source unique id if it exists, otherwise returns the playlist unique ID.
source_uploader
~~~~~~~~~~~~~~~
:type: ``String``
:description:
The source uploader if it exists, otherwise return the playlist_uploader
source_uploader_id
~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The source uploader id if it exists, otherwise returns the playlist_uploader_id
source_uploader_url
~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The source uploader url if it exists, otherwise returns the source webpage_url.
source_webpage_url
~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The source webpage url if it exists, otherwise returns the playlist webpage url.
----------------------------------------------------------------------------------------------------
@ -348,72 +496,106 @@ Upload Date Variables
upload_date
~~~~~~~~~~~
:type: ``String``
:description:
The entrys uploaded date, in YYYYMMDD format. If not present, return todays date.
upload_date_standardized
~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The uploaded date formatted as YYYY-MM-DD
upload_day
~~~~~~~~~~
:type: ``Integer``
:description:
The upload day as an integer (no padding).
upload_day_of_year
~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
The day of the year, i.e. February 1st returns ``32``
upload_day_of_year_padded
~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The upload day of year, but padded i.e. February 1st returns "032"
upload_day_of_year_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
: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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The reversed upload day of year, but padded i.e. December 31st returns "001"
upload_day_padded
~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The entry's upload day padded to two digits, i.e. the fifth returns "05"
upload_day_reversed
~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
: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
~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The reversed upload day, but padded. i.e. August 30th returns "02".
upload_month
~~~~~~~~~~~~
:type: ``Integer``
:description:
The upload month as an integer (no padding).
upload_month_padded
~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The entry's upload month padded to two digits, i.e. March returns "03"
upload_month_reversed
~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
The upload month, but reversed using ``13 - {upload_month}``, i.e. March returns ``10``
upload_month_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The reversed upload month, but padded. i.e. November returns "02"
upload_year
~~~~~~~~~~~
:type: ``Integer``
:description:
The entry's upload year
upload_year_truncated
~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
The last two digits of the upload year, i.e. 22 in 2022
upload_year_truncated_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
: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
~~~~~~~~~~~~~~
:type: ``Integer``
:description:
The i'th entry downloaded. NOTE that this is fetched dynamically from the download
archive.
download_index_padded6
~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The download_index padded six digits
upload_date_index
~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
The i'th entry downloaded with this upload date.
upload_date_index_padded
~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The upload_date_index padded two digits
upload_date_index_reversed
~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``Integer``
:description:
100 - upload_date_index
upload_date_index_reversed_padded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:type: ``String``
:description:
The upload_date_index padded two digits
ytdl_sub_input_url
~~~~~~~~~~~~~~~~~~
: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)
- month (Integer)
- day (Integer)
- year_truncated (String, YY from YY[YY])
- year_truncated (Integer, YY from YY[YY])
- month_padded (String)
- day_padded (String)
- year_truncated_reversed (Integer, 100 - year_truncated)

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import inspect
from functools import cached_property
from typing import Any
from typing import Dict
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))
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]:
return sorted(
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(
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:
display_function_name = display_function_name if display_function_name else function_name
docs = section(display_function_name, level=level)
docs += pre_docstring or ""
docs += inspect.cleandoc(getattr(obj, function_name).__doc__)
docs += "\n"
return docs