[FEATURE] channel_id source variable (#575)
This commit is contained in:
parent
e1f2e37858
commit
14c7865165
3 changed files with 13 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ from yt_dlp.utils import sanitize_filename
|
||||||
from ytdl_sub.entries.base_entry import BaseEntry
|
from ytdl_sub.entries.base_entry import BaseEntry
|
||||||
from ytdl_sub.entries.base_entry import BaseEntryVariables
|
from ytdl_sub.entries.base_entry import BaseEntryVariables
|
||||||
from ytdl_sub.entries.variables.kwargs import CHANNEL
|
from ytdl_sub.entries.variables.kwargs import CHANNEL
|
||||||
|
from ytdl_sub.entries.variables.kwargs import CHANNEL_ID
|
||||||
from ytdl_sub.entries.variables.kwargs import CREATOR
|
from ytdl_sub.entries.variables.kwargs import CREATOR
|
||||||
from ytdl_sub.entries.variables.kwargs import DOWNLOAD_INDEX
|
from ytdl_sub.entries.variables.kwargs import DOWNLOAD_INDEX
|
||||||
from ytdl_sub.entries.variables.kwargs import EXT
|
from ytdl_sub.entries.variables.kwargs import EXT
|
||||||
|
|
@ -391,6 +392,16 @@ class EntryVariables(BaseEntryVariables):
|
||||||
"""
|
"""
|
||||||
return sanitize_filename(self.channel)
|
return sanitize_filename(self.channel)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def channel_id(self: Self) -> str:
|
||||||
|
"""
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
str
|
||||||
|
The channel id if it exists, otherwise returns the entry uploader ID.
|
||||||
|
"""
|
||||||
|
return self.kwargs_get(CHANNEL_ID, self.uploader_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ext(self: Self) -> str:
|
def ext(self: Self) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ EXTRACTOR = _("extractor")
|
||||||
IE_KEY = _("ie_key")
|
IE_KEY = _("ie_key")
|
||||||
EPOCH = _("epoch")
|
EPOCH = _("epoch")
|
||||||
CHANNEL = _("channel")
|
CHANNEL = _("channel")
|
||||||
|
CHANNEL_ID = _("channel_id")
|
||||||
CREATOR = _("creator")
|
CREATOR = _("creator")
|
||||||
EXT = _("ext")
|
EXT = _("ext")
|
||||||
TITLE = _("title")
|
TITLE = _("title")
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ def mock_entry_to_dict(
|
||||||
"creator_sanitized": "abc123",
|
"creator_sanitized": "abc123",
|
||||||
"channel": "abc123",
|
"channel": "abc123",
|
||||||
"channel_sanitized": "abc123",
|
"channel_sanitized": "abc123",
|
||||||
|
"channel_id": uid,
|
||||||
"extractor": extractor,
|
"extractor": extractor,
|
||||||
"uploader": "abc123",
|
"uploader": "abc123",
|
||||||
"uploader_id": "abc123",
|
"uploader_id": "abc123",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue