[BUGFIX] Fix extractor IDs in yt-dlp download archive (#528)
This commit is contained in:
parent
e5949abce0
commit
0cd8df6e11
4 changed files with 26 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ from yt_dlp.utils import sanitize_filename
|
|||
from ytdl_sub.entries.variables.kwargs import DESCRIPTION
|
||||
from ytdl_sub.entries.variables.kwargs import EPOCH
|
||||
from ytdl_sub.entries.variables.kwargs import EXTRACTOR
|
||||
from ytdl_sub.entries.variables.kwargs import IE_KEY
|
||||
from ytdl_sub.entries.variables.kwargs import TITLE
|
||||
from ytdl_sub.entries.variables.kwargs import UID
|
||||
from ytdl_sub.entries.variables.kwargs import UPLOADER
|
||||
|
|
@ -101,7 +102,10 @@ class BaseEntryVariables:
|
|||
str
|
||||
The ytdl extractor name
|
||||
"""
|
||||
return self.kwargs(EXTRACTOR)
|
||||
# pylint: disable=line-too-long
|
||||
# Taken from https://github.com/yt-dlp/yt-dlp/blob/e6ab678e36c40ded0aae305bbb866cdab554d417/yt_dlp/YoutubeDL.py#L3514
|
||||
# pylint: enable=line-too-long
|
||||
return self.kwargs_get(EXTRACTOR) or self.kwargs(IE_KEY)
|
||||
|
||||
@property
|
||||
def epoch(self: "BaseEntry") -> int:
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ SPLIT_BY_CHAPTERS_PARENT_ENTRY = _("split_by_chapters_parent_entry", backend=Tru
|
|||
COMMENTS = _("comments", backend=True)
|
||||
UID = _("id")
|
||||
EXTRACTOR = _("extractor")
|
||||
IE_KEY = _("ie_key")
|
||||
EPOCH = _("epoch")
|
||||
CHANNEL = _("channel")
|
||||
EXT = _("ext")
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from typing import Optional
|
|||
from typing import Set
|
||||
|
||||
from yt_dlp import DateRange
|
||||
from yt_dlp.utils import make_archive_id
|
||||
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.entries.variables.kwargs import SPLIT_BY_CHAPTERS_PARENT_ENTRY
|
||||
|
|
@ -313,7 +314,7 @@ class DownloadMappings:
|
|||
"""
|
||||
lines: List[str] = []
|
||||
for entry_id, metadata in self._entry_mappings.items():
|
||||
lines.append(f"{metadata.extractor} {entry_id}")
|
||||
lines.append(make_archive_id(ie=metadata.extractor, video_id=entry_id))
|
||||
|
||||
return DownloadArchive(download_archive_lines=lines)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import pytest
|
||||
from conftest import assert_logs
|
||||
from expected_download import assert_expected_downloads
|
||||
from expected_transaction_log import assert_transaction_log_matches
|
||||
|
||||
import ytdl_sub.downloaders.downloader
|
||||
from ytdl_sub.subscriptions.subscription import Subscription
|
||||
|
||||
|
||||
|
|
@ -59,3 +61,19 @@ class TestBandcamp:
|
|||
dry_run=dry_run,
|
||||
expected_download_summary_file_name="bandcamp/test_artist_url.json",
|
||||
)
|
||||
|
||||
# Ensure another invocation will hit ExistingVideoReached
|
||||
if not dry_run:
|
||||
with assert_logs(
|
||||
logger=ytdl_sub.downloaders.downloader.download_logger,
|
||||
expected_message="ExistingVideoReached, stopping additional downloads",
|
||||
log_level="debug",
|
||||
):
|
||||
transaction_log = discography_subscription.download()
|
||||
|
||||
assert transaction_log.is_empty
|
||||
assert_expected_downloads(
|
||||
output_directory=output_directory,
|
||||
dry_run=dry_run,
|
||||
expected_download_summary_file_name="bandcamp/test_artist_url.json",
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue