From 32bcc157ac4a047ed276fab3f03e81eb02ab1538 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Thu, 7 Dec 2023 18:09:22 -0800 Subject: [PATCH] integration running, need to do resolve hacking --- src/ytdl_sub/downloaders/url/downloader.py | 8 ++++++-- src/ytdl_sub/entries/script/variable_scripts.py | 7 ++++--- src/ytdl_sub/entries/variables/kwargs.py | 1 + src/ytdl_sub/ytdl_additions/enhanced_download_archive.py | 2 +- tests/unit/conftest.py | 3 ++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ytdl_sub/downloaders/url/downloader.py b/src/ytdl_sub/downloaders/url/downloader.py index a4f45209..1cf129ca 100644 --- a/src/ytdl_sub/downloaders/url/downloader.py +++ b/src/ytdl_sub/downloaders/url/downloader.py @@ -516,10 +516,14 @@ class MultiUrlDownloader(SourcePlugin[MultiUrlValidator]): # Same with sponsorblock chapters SPONSORBLOCK_CHAPTERS: download_entry.kwargs_get(SPONSORBLOCK_CHAPTERS), COMMENTS: download_entry.kwargs_get(COMMENTS), + } + ) + entry.add( + { # Tracks number of entries downloaded - DOWNLOAD_INDEX: download_idx, + v.download_index.variable_name: download_idx + 1, # Tracks number of entries with the same upload date to make them unique - UPLOAD_DATE_INDEX: upload_date_idx, + v.upload_date_index.variable_name: upload_date_idx + 1, } ) diff --git a/src/ytdl_sub/entries/script/variable_scripts.py b/src/ytdl_sub/entries/script/variable_scripts.py index a9c891f7..ed8bb252 100644 --- a/src/ytdl_sub/entries/script/variable_scripts.py +++ b/src/ytdl_sub/entries/script/variable_scripts.py @@ -128,9 +128,10 @@ ENTRY_DEFAULT_VARIABLES: Dict[MetadataVariable, str] = { v.channel_id: entry_get(v.channel_id, v.uploader_id), } -ENTRY_INJECTED_VARIABLES: Dict[MetadataVariable, str] = { - v.download_index: entry_get_int(v.download_index, 1), - v.upload_date_index: entry_get_int(v.upload_date_index, 1), +# TODO: MARK AS UNRESOLVABLE UNTIL THEY ARE ADDED +ENTRY_INJECTED_VARIABLES: Dict[Variable, str] = { + v.download_index: "{%int(1)}", + v.upload_date_index: "{%int(1)}", } ENTRY_DERIVED_VARIABLES: Dict[Variable, str] = { diff --git a/src/ytdl_sub/entries/variables/kwargs.py b/src/ytdl_sub/entries/variables/kwargs.py index 84f729f9..35a656cc 100644 --- a/src/ytdl_sub/entries/variables/kwargs.py +++ b/src/ytdl_sub/entries/variables/kwargs.py @@ -52,6 +52,7 @@ SPLIT_BY_CHAPTERS_PARENT_ENTRY = _("split_by_chapters_parent_entry", backend=Tru COMMENTS = _("comments", backend=True) UID = _("id") EXTRACTOR = _("extractor") +EXTRACTOR_KEY = _("extractor_key") IE_KEY = _("ie_key") EPOCH = _("epoch") CHANNEL = _("channel") diff --git a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py index a03a3233..0c91c050 100644 --- a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py +++ b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py @@ -73,7 +73,7 @@ class DownloadMapping: """ return DownloadMapping( upload_date=entry.get(v.upload_date_standardized), - extractor=entry.extractor, + extractor=entry.get(v.extractor), file_names=set(), ) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index de4ef21d..bee86349 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -16,6 +16,7 @@ from ytdl_sub.entries.variables.kwargs import DESCRIPTION from ytdl_sub.entries.variables.kwargs import EPOCH from ytdl_sub.entries.variables.kwargs import EXT from ytdl_sub.entries.variables.kwargs import EXTRACTOR +from ytdl_sub.entries.variables.kwargs import EXTRACTOR_KEY from ytdl_sub.entries.variables.kwargs import IE_KEY from ytdl_sub.entries.variables.kwargs import PLAYLIST_COUNT from ytdl_sub.entries.variables.kwargs import PLAYLIST_ENTRY @@ -69,7 +70,7 @@ def mock_entry_dict_factory(mock_downloaded_file_path) -> Callable: PLAYLIST_INDEX: playlist_index, PLAYLIST_COUNT: playlist_count, EXTRACTOR: "mock-entry-dict", - IE_KEY: "mock-ie-key", + EXTRACTOR_KEY: "mock-extractor-key", TITLE: f"Mock Entry {uid}", EXT: "mp4", UPLOAD_DATE: upload_date,