[BUGFIX] Use proper extractor key for download archive

This commit is contained in:
Jesse Bannon 2023-12-14 16:23:15 -08:00
parent 8998861b49
commit d8df54859e
4 changed files with 21 additions and 1 deletions

View file

@ -105,7 +105,7 @@ class BaseEntryVariables:
# pylint: disable=line-too-long # pylint: disable=line-too-long
# Taken from https://github.com/yt-dlp/yt-dlp/blob/e6ab678e36c40ded0aae305bbb866cdab554d417/yt_dlp/YoutubeDL.py#L3514 # Taken from https://github.com/yt-dlp/yt-dlp/blob/e6ab678e36c40ded0aae305bbb866cdab554d417/yt_dlp/YoutubeDL.py#L3514
# pylint: enable=line-too-long # pylint: enable=line-too-long
return self.kwargs_get(EXTRACTOR) or self.kwargs(IE_KEY) return self.kwargs_get("extractor_key") or self.kwargs("ie_key")
@property @property
def epoch(self: "BaseEntry") -> int: def epoch(self: "BaseEntry") -> int:

View file

@ -1,7 +1,9 @@
import pytest import pytest
from conftest import assert_logs
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches from expected_transaction_log import assert_transaction_log_matches
from ytdl_sub.downloaders.ytdlp import YTDLP
from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.subscriptions.subscription import Subscription
@ -48,3 +50,19 @@ class TestSoundcloudDiscography:
dry_run=dry_run, dry_run=dry_run,
expected_download_summary_file_name="soundcloud/test_soundcloud_discography.json", expected_download_summary_file_name="soundcloud/test_soundcloud_discography.json",
) )
# Ensure another invocation will hit ExistingVideoReached
if not dry_run:
with assert_logs(
logger=YTDLP.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="soundcloud/test_soundcloud_discography.json",
)

View file

@ -68,6 +68,7 @@ def mock_entry_dict_factory(mock_downloaded_file_path) -> Callable:
PLAYLIST_INDEX: playlist_index, PLAYLIST_INDEX: playlist_index,
PLAYLIST_COUNT: playlist_count, PLAYLIST_COUNT: playlist_count,
EXTRACTOR: "mock-entry-dict", EXTRACTOR: "mock-entry-dict",
"extractor_key": "mock-entry-dict",
TITLE: f"Mock Entry {uid}", TITLE: f"Mock Entry {uid}",
EXT: "mp4", EXT: "mp4",
UPLOAD_DATE: upload_date, UPLOAD_DATE: upload_date,

View file

@ -163,6 +163,7 @@ def mock_entry_kwargs(
"id": uid, "id": uid,
"epoch": 1596878400, "epoch": 1596878400,
"extractor": extractor, "extractor": extractor,
"extractor_key": extractor,
"title": title, "title": title,
"ext": ext, "ext": ext,
"upload_date": upload_date, "upload_date": upload_date,