nest the variabesl
This commit is contained in:
parent
17ef801c7b
commit
a086329824
3 changed files with 42 additions and 33 deletions
|
|
@ -12,6 +12,9 @@ from yt_dlp.utils import sanitize_filename
|
|||
|
||||
from ytdl_sub.entries.variables.kwargs import DESCRIPTION
|
||||
from ytdl_sub.entries.variables.kwargs import TITLE
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER_ID
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER_URL
|
||||
from ytdl_sub.entries.variables.kwargs import WEBPAGE_URL
|
||||
|
||||
# pylint: disable=no-member
|
||||
|
|
@ -96,6 +99,36 @@ class BaseEntryVariables:
|
|||
"""
|
||||
return self.kwargs_get(DESCRIPTION, "")
|
||||
|
||||
@property
|
||||
def uploader_id(self: "BaseEntry") -> str:
|
||||
"""
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The uploader id if it exists, otherwise return the unique ID.
|
||||
"""
|
||||
return self.kwargs_get(UPLOADER_ID, self.uid)
|
||||
|
||||
@property
|
||||
def uploader(self: "BaseEntry") -> str:
|
||||
"""
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The uploader if it exists, otherwise return the uploader ID.
|
||||
"""
|
||||
return self.kwargs_get(UPLOADER, self.uploader_id)
|
||||
|
||||
@property
|
||||
def uploader_url(self: "BaseEntry") -> str:
|
||||
"""
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The uploader url if it exists, otherwise returns the webpage_url.
|
||||
"""
|
||||
return self.kwargs_get(UPLOADER_URL, self.webpage_url)
|
||||
|
||||
|
||||
# pylint: enable=no-member
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ from ytdl_sub.entries.variables.kwargs import PLAYLIST_MAX_UPLOAD_YEAR
|
|||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_MAX_UPLOAD_YEAR_TRUNCATED
|
||||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_TITLE
|
||||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_UID
|
||||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_UPLOADER
|
||||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_UPLOADER_ID
|
||||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_UPLOADER_URL
|
||||
from ytdl_sub.entries.variables.kwargs import PLAYLIST_WEBPAGE_URL
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_COUNT
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_DESCRIPTION
|
||||
|
|
@ -24,6 +27,9 @@ from ytdl_sub.entries.variables.kwargs import SOURCE_ENTRY
|
|||
from ytdl_sub.entries.variables.kwargs import SOURCE_INDEX
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_TITLE
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_UID
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_UPLOADER
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_UPLOADER_ID
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_UPLOADER_URL
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_WEBPAGE_URL
|
||||
|
||||
|
||||
|
|
@ -77,6 +83,9 @@ class EntryParent(BaseEntry):
|
|||
_(SOURCE_WEBPAGE_URL, PLAYLIST_WEBPAGE_URL): self.webpage_url,
|
||||
_(SOURCE_UID, PLAYLIST_UID): self.uid,
|
||||
_(SOURCE_DESCRIPTION, PLAYLIST_DESCRIPTION): self.description,
|
||||
_(SOURCE_UPLOADER, PLAYLIST_UPLOADER): self.uploader,
|
||||
_(SOURCE_UPLOADER_ID, PLAYLIST_UPLOADER_ID): self.uploader_id,
|
||||
_(SOURCE_UPLOADER_URL, PLAYLIST_UPLOADER_URL): self.uploader_url,
|
||||
}
|
||||
|
||||
def _get_entry_children_variable_list(self, variable_name: str) -> List[str | int]:
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ from ytdl_sub.entries.variables.kwargs import SOURCE_UPLOADER
|
|||
from ytdl_sub.entries.variables.kwargs import SOURCE_UPLOADER_ID
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_UPLOADER_URL
|
||||
from ytdl_sub.entries.variables.kwargs import SOURCE_WEBPAGE_URL
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER_ID
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER_URL
|
||||
|
||||
# This file contains mixins to a BaseEntry subclass. Ignore pylint's "no kwargs member" suggestion
|
||||
# pylint: disable=no-member
|
||||
|
|
@ -235,36 +232,6 @@ class EntryVariables(BaseEntryVariables):
|
|||
"""
|
||||
return self.kwargs_get(PLAYLIST_MAX_UPLOAD_YEAR_TRUNCATED, self.upload_year_truncated)
|
||||
|
||||
@property
|
||||
def uploader_id(self: Self) -> str:
|
||||
"""
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The uploader id if it exists, otherwise return the unique ID.
|
||||
"""
|
||||
return self.kwargs_get(UPLOADER_ID, self.uid)
|
||||
|
||||
@property
|
||||
def uploader(self: Self) -> str:
|
||||
"""
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The uploader if it exists, otherwise return the uploader ID.
|
||||
"""
|
||||
return self.kwargs_get(UPLOADER, self.uploader_id)
|
||||
|
||||
@property
|
||||
def uploader_url(self: Self) -> str:
|
||||
"""
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The uploader url if it exists, otherwise returns the webpage_url.
|
||||
"""
|
||||
return self.kwargs_get(UPLOADER_URL, self.webpage_url)
|
||||
|
||||
@property
|
||||
def playlist_uploader_id(self: Self) -> str:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue