From 730a5a89d509ff80b717d609cd4e5f167da494d0 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 28 Sep 2022 14:01:36 -0700 Subject: [PATCH] apply formatter --- src/ytdl_sub/downloaders/downloader.py | 6 ++++-- src/ytdl_sub/downloaders/generic/collection_validator.py | 4 ++-- src/ytdl_sub/downloaders/youtube/merge_playlist.py | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ytdl_sub/downloaders/downloader.py b/src/ytdl_sub/downloaders/downloader.py index 93b76614..a2509ee7 100644 --- a/src/ytdl_sub/downloaders/downloader.py +++ b/src/ytdl_sub/downloaders/downloader.py @@ -428,15 +428,17 @@ class Downloader(DownloadArchiver, Generic[DownloaderOptionsT], ABC): """ Downloads only info.json files and forms EntryParent trees """ + url = self.overrides.apply_formatter(collection_url.url) + with self._separate_download_archives(): entry_dicts = self.extract_info_via_info_json( only_info_json=True, - url=collection_url.url, + url=url, log_prefix_on_info_json_dl="Downloading metadata for", ) self.parents = EntryParent.from_entry_dicts( - url=collection_url.url, + url=url, entry_dicts=entry_dicts, working_directory=self.working_directory, ) diff --git a/src/ytdl_sub/downloaders/generic/collection_validator.py b/src/ytdl_sub/downloaders/generic/collection_validator.py index 1a03a074..5af9ebaf 100644 --- a/src/ytdl_sub/downloaders/generic/collection_validator.py +++ b/src/ytdl_sub/downloaders/generic/collection_validator.py @@ -59,13 +59,13 @@ class CollectionUrlValidator(StrictDictValidator): ) @property - def url(self) -> str: + def url(self) -> OverridesStringFormatterValidator: """ URL to download from, listed in priority from lowest (top) to highest (bottom). If a download exists in more than one URL, it will resolve to the bottom-most one and inherit those variables. """ - return self._url.value + return self._url @property def variables(self) -> DictFormatterValidator: diff --git a/src/ytdl_sub/downloaders/youtube/merge_playlist.py b/src/ytdl_sub/downloaders/youtube/merge_playlist.py index f9117e6f..94712427 100644 --- a/src/ytdl_sub/downloaders/youtube/merge_playlist.py +++ b/src/ytdl_sub/downloaders/youtube/merge_playlist.py @@ -144,7 +144,9 @@ class YoutubeMergePlaylistDownloader(Downloader[YoutubeMergePlaylistDownloaderOp def download(self) -> List[Tuple[Entry, FileMetadata]]: """Download a single Youtube video, then split it into multiple videos""" - entry_dict = self.extract_info(url=self.collection.collection_urls.list[0].url) + url = self.overrides.apply_formatter(self.collection.collection_urls.list[0].url) + + entry_dict = self.extract_info(url=url) merged_video = self._to_merged_video(entry_dict=entry_dict) merged_video_metadata = self._get_chapters(