[DOCS] Clean up source variable readthedocs section (#152)

This commit is contained in:
Jesse Bannon 2022-08-04 17:34:06 -07:00 committed by GitHub
parent b28ef2365b
commit 5244b7c939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 36 deletions

View file

@ -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
-------------------------------------------------------------------------------

View file

@ -24,6 +24,7 @@ class SourceVariables:
"""
Returns
-------
str
The entry's unique ID
"""
return self.kwargs("id")
@ -33,6 +34,7 @@ class SourceVariables:
"""
Returns
-------
str
The ytdl extractor name
"""
return self.kwargs("extractor")
@ -74,6 +76,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
str
The title of the entry
"""
return self.kwargs("title")
@ -83,6 +86,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
str
The sanitized title of the entry, which is safe to use for Unix and Windows file names.
"""
return sanitize_filename(self.title)
@ -92,6 +96,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
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,6 +117,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
str
The entry's uploaded date, in YYYYMMDD format.
"""
return self.kwargs("upload_date")
@ -120,6 +127,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
int
The entry's upload year
"""
return int(self.upload_date[:4])
@ -129,6 +137,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
int
The last two digits of the upload year, i.e. 22 in 2022
"""
return int(self.upload_date[:2])
@ -138,6 +147,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
str
The entry's upload month padded to two digits, i.e. March returns "03"
"""
return self.upload_date[4:6]
@ -147,6 +157,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
str
The entry's upload day padded to two digits, i.e. the fifth returns "05"
"""
return self.upload_date[6:8]
@ -156,6 +167,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
int
The upload month as an integer (no padding).
"""
return int(self.upload_month_padded.lstrip("0"))
@ -165,6 +177,7 @@ class EntryVariables(SourceVariables):
"""
Returns
-------
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
-------
str
The uploaded date formatted as YYYY-MM-DD
"""
return f"{self.upload_year}-{self.upload_month_padded}-{self.upload_day_padded}"

View file

@ -12,6 +12,7 @@ class SoundcloudVariables(EntryVariables):
"""
Returns
-------
int
The entry's track number within an album. For singles, it will always be 1.
"""
return 1
@ -21,6 +22,7 @@ class SoundcloudVariables(EntryVariables):
"""
Returns
-------
str
The entry's track number, padded two digits.
"""
return f"{self.track_number:02d}"
@ -30,6 +32,7 @@ class SoundcloudVariables(EntryVariables):
"""
Returns
-------
int
The total tracks in album. For singles, it will always be 1.
"""
return 1
@ -39,6 +42,7 @@ class SoundcloudVariables(EntryVariables):
"""
Returns
-------
str
The entry's album name. For singles, it will be the same as the title.
"""
return self.title
@ -48,6 +52,7 @@ class SoundcloudVariables(EntryVariables):
"""
Returns
-------
str
The entry's sanitized album name, which is safe to use for Unix and Windows file names.
"""
return sanitize_filename(self.album)
@ -57,6 +62,7 @@ class SoundcloudVariables(EntryVariables):
"""
Returns
-------
int
The entry's album year, which is determined by the latest year amongst all tracks in the
album.
"""

View file

@ -13,6 +13,7 @@ class YoutubeVideoVariables(EntryVariables):
"""
Returns
-------
str
The channel name.
"""
return self.kwargs("channel")
@ -22,6 +23,7 @@ class YoutubeVideoVariables(EntryVariables):
"""
Returns
-------
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,6 +49,7 @@ class YoutubeVideoVariables(EntryVariables):
"""
Returns
-------
str
The sanitized track title.
"""
return sanitize_filename(self.track_title)
@ -55,6 +59,7 @@ class YoutubeVideoVariables(EntryVariables):
"""
Returns
-------
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.
@ -69,6 +74,7 @@ class YoutubeVideoVariables(EntryVariables):
"""
Returns
-------
str
The sanitized artist name.
"""
return sanitize_filename(self.artist)
@ -78,6 +84,7 @@ class YoutubeVideoVariables(EntryVariables):
"""
Returns
-------
int
The index of the video in the playlist. For non-playlist download strategies, this will
always 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")