diff --git a/docs/config.rst b/docs/config.rst index 521628e6..45d2565d 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -261,6 +261,7 @@ Youtube Variables :members: :inherited-members: :undoc-members: + :exclude-members: source_variables .. _soundcloud-variables: @@ -270,6 +271,7 @@ Soundcloud Variables :members: :inherited-members: :undoc-members: + :exclude-members: source_variables ------------------------------------------------------------------------------- diff --git a/src/ytdl_sub/entries/variables/entry_variables.py b/src/ytdl_sub/entries/variables/entry_variables.py index 69c0fa26..dfb1b1ca 100644 --- a/src/ytdl_sub/entries/variables/entry_variables.py +++ b/src/ytdl_sub/entries/variables/entry_variables.py @@ -24,7 +24,8 @@ class SourceVariables: """ Returns ------- - The entry's unique ID + str + The entry's unique ID """ return self.kwargs("id") @@ -33,7 +34,8 @@ class SourceVariables: """ Returns ------- - The ytdl extractor name + str + The ytdl extractor name """ return self.kwargs("extractor") @@ -74,7 +76,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The title of the entry + str + The title of the entry """ return self.kwargs("title") @@ -83,7 +86,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The sanitized title of the entry, which is safe to use for Unix and Windows file names. + str + The sanitized title of the entry, which is safe to use for Unix and Windows file names. """ return sanitize_filename(self.title) @@ -92,7 +96,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The downloaded entry's file extension + str + The downloaded entry's file extension """ return self.kwargs("ext") @@ -101,8 +106,9 @@ class EntryVariables(SourceVariables): """ Returns ------- - 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. + str + 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. """ return "jpg" @@ -111,7 +117,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The entry's uploaded date, in YYYYMMDD format. + str + The entry's uploaded date, in YYYYMMDD format. """ return self.kwargs("upload_date") @@ -120,7 +127,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The entry's upload year + int + The entry's upload year """ return int(self.upload_date[:4]) @@ -129,7 +137,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The last two digits of the upload year, i.e. 22 in 2022 + int + The last two digits of the upload year, i.e. 22 in 2022 """ return int(self.upload_date[:2]) @@ -138,7 +147,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The entry's upload month padded to two digits, i.e. March returns "03" + str + The entry's upload month padded to two digits, i.e. March returns "03" """ return self.upload_date[4:6] @@ -147,7 +157,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The entry's upload day padded to two digits, i.e. the fifth returns "05" + str + The entry's upload day padded to two digits, i.e. the fifth returns "05" """ return self.upload_date[6:8] @@ -156,7 +167,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The upload month as an integer (no padding). + int + The upload month as an integer (no padding). """ return int(self.upload_month_padded.lstrip("0")) @@ -165,7 +177,8 @@ class EntryVariables(SourceVariables): """ Returns ------- - The upload day as an integer (no padding). + int + The upload day as an integer (no padding). """ return int(self.upload_day_padded.lstrip("0")) @@ -174,6 +187,7 @@ class EntryVariables(SourceVariables): """ Returns ------- - The uploaded date formatted as YYYY-MM-DD + str + The uploaded date formatted as YYYY-MM-DD """ return f"{self.upload_year}-{self.upload_month_padded}-{self.upload_day_padded}" diff --git a/src/ytdl_sub/entries/variables/soundcloud_variables.py b/src/ytdl_sub/entries/variables/soundcloud_variables.py index 52360e90..349fafb5 100644 --- a/src/ytdl_sub/entries/variables/soundcloud_variables.py +++ b/src/ytdl_sub/entries/variables/soundcloud_variables.py @@ -12,7 +12,8 @@ class SoundcloudVariables(EntryVariables): """ Returns ------- - The entry's track number within an album. For singles, it will always be 1. + int + The entry's track number within an album. For singles, it will always be 1. """ return 1 @@ -21,7 +22,8 @@ class SoundcloudVariables(EntryVariables): """ Returns ------- - The entry's track number, padded two digits. + str + The entry's track number, padded two digits. """ return f"{self.track_number:02d}" @@ -30,7 +32,8 @@ class SoundcloudVariables(EntryVariables): """ Returns ------- - The total tracks in album. For singles, it will always be 1. + int + The total tracks in album. For singles, it will always be 1. """ return 1 @@ -39,7 +42,8 @@ class SoundcloudVariables(EntryVariables): """ Returns ------- - The entry's album name. For singles, it will be the same as the title. + str + The entry's album name. For singles, it will be the same as the title. """ return self.title @@ -48,7 +52,8 @@ class SoundcloudVariables(EntryVariables): """ Returns ------- - The entry's sanitized album name, which is safe to use for Unix and Windows file names. + str + The entry's sanitized album name, which is safe to use for Unix and Windows file names. """ return sanitize_filename(self.album) @@ -57,7 +62,8 @@ class SoundcloudVariables(EntryVariables): """ Returns ------- - The entry's album year, which is determined by the latest year amongst all tracks in the - album. + int + The entry's album year, which is determined by the latest year amongst all tracks in the + album. """ return self.upload_year diff --git a/src/ytdl_sub/entries/variables/youtube_variables.py b/src/ytdl_sub/entries/variables/youtube_variables.py index 83da35b6..181c2046 100644 --- a/src/ytdl_sub/entries/variables/youtube_variables.py +++ b/src/ytdl_sub/entries/variables/youtube_variables.py @@ -13,7 +13,8 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The channel name. + str + The channel name. """ return self.kwargs("channel") @@ -22,7 +23,8 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The channel name, sanitized. + str + The channel name, sanitized. """ return sanitize_filename(self.channel) @@ -31,9 +33,10 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The track title of a music video if it is available, otherwise it falls back to the title. - NOTE: Even if a video has music metadata, this variable does not always get pulled via - yt-dlp. Use with caution. + str + The track title of a music video if it is available, otherwise it falls back to the + title. NOTE: Even if a video has music metadata, this variable does not always get + pulled via yt-dlp. Use with caution. """ # Try to get the track, fall back on title if self.kwargs_contains("track"): @@ -46,7 +49,8 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The sanitized track title. + str + The sanitized track title. """ return sanitize_filename(self.track_title) @@ -55,9 +59,10 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The artist of a music video if it is available, otherwise it falls back to the channel. - NOTE: Even if a video has music metadata, this variable does not always get pulled via - yt-dlp. Use with caution. + str + The artist of a music video if it is available, otherwise it falls back to the channel. + NOTE: Even if a video has music metadata, this variable does not always get pulled via + yt-dlp. Use with caution. """ if self.kwargs_contains("artist"): return self.kwargs("artist") @@ -69,7 +74,8 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The sanitized artist name. + str + The sanitized artist name. """ return sanitize_filename(self.artist) @@ -78,8 +84,9 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The index of the video in the playlist. For non-playlist download strategies, this will - always return 1. + int + The index of the video in the playlist. For non-playlist download strategies, this will + always return 1. """ return 1 @@ -88,7 +95,9 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The size of the playlist. For non-playlist download strategies, this will always return 1. + int + The size of the playlist. For non-playlist download strategies, this will always return + 1. """ return 1 @@ -97,6 +106,7 @@ class YoutubeVideoVariables(EntryVariables): """ Returns ------- - The description of the entry. + str + The video description. """ return self.kwargs("description")