From 0641a308ab3d625efdabd1f979c66b3510cf1364 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 8 Nov 2022 21:48:50 -0800 Subject: [PATCH] download strategy docs, fix tests --- docs/config.rst | 15 +++++++++++++-- src/ytdl_sub/downloaders/downloader.py | 2 +- src/ytdl_sub/downloaders/generic/validators.py | 4 ++-- .../downloaders/youtube/merge_playlist.py | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 9c7f26f1..d04837fa 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -39,13 +39,13 @@ download strategy has its own set of parameters. url ''' .. autoclass:: ytdl_sub.downloaders.generic.url.UrlDownloadOptions() - :members: + :members: url, playlist_thumbnails, source_thumbnails :member-order: bysource multi_url ''''''''' .. autoclass:: ytdl_sub.downloaders.generic.multi_url.MultiUrlDownloadOptions() - :members: + :members: urls :member-order: bysource ------------------------------------------------------------------------------- @@ -119,6 +119,7 @@ audio_extract .. autoclass:: ytdl_sub.plugins.audio_extract.AudioExtractOptions() :members: :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -127,6 +128,7 @@ chapters .. autoclass:: ytdl_sub.plugins.chapters.ChaptersOptions() :members: :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -135,12 +137,14 @@ date_range .. autoclass:: ytdl_sub.plugins.date_range.DateRangeOptions() :members: :member-order: bysource + :exclude-members: partial_validate file_convert '''''''''''' .. autoclass:: ytdl_sub.plugins.file_convert.FileConvertOptions() :members: :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -148,6 +152,7 @@ music_tags '''''''''' .. autoclass:: ytdl_sub.plugins.music_tags.MusicTagsOptions() :members: + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -156,6 +161,7 @@ nfo_tags .. autoclass:: ytdl_sub.plugins.nfo_tags.NfoTagsOptions() :members: nfo_name, nfo_root, tags, kodi_safe :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -164,6 +170,7 @@ output_directory_nfo_tags .. autoclass:: ytdl_sub.plugins.output_directory_nfo_tags.OutputDirectoryNfoTagsOptions() :members: nfo_name, nfo_root, tags, kodi_safe :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -175,6 +182,7 @@ regex .. autoclass:: ytdl_sub.plugins.regex.SourceVariableRegex() :members: match, capture_group_names, capture_group_defaults :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -183,6 +191,7 @@ split_by_chapters .. autoclass:: ytdl_sub.plugins.split_by_chapters.SplitByChaptersOptions() :members: when_no_chapters :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -191,6 +200,7 @@ subtitles .. autoclass:: ytdl_sub.plugins.subtitles.SubtitleOptions() :members: subtitles_name, subtitles_type, embed_subtitles, languages, allow_auto_generated_subtitles :member-order: bysource + :exclude-members: partial_validate ------------------------------------------------------------------------------- @@ -198,6 +208,7 @@ video_tags '''''''''' .. autoclass:: ytdl_sub.plugins.video_tags.VideoTagsOptions() :members: + :exclude-members: partial_validate ------------------------------------------------------------------------------- diff --git a/src/ytdl_sub/downloaders/downloader.py b/src/ytdl_sub/downloaders/downloader.py index 1a1da366..45f6fe7f 100644 --- a/src/ytdl_sub/downloaders/downloader.py +++ b/src/ytdl_sub/downloaders/downloader.py @@ -550,7 +550,7 @@ class Downloader(DownloadArchiver, Generic[DownloaderOptionsT], ABC): ) -> Iterable[Entry] | Iterable[Tuple[Entry, FileMetadata]]: """The function to perform the download of all media entries""" # download the bottom-most urls first since they are top-priority - for collection_url in reversed(self.collection.collection_urls.list): + for collection_url in reversed(self.collection.urls.list): parents, orphan_entries = self._download_url_metadata(collection_url=collection_url) collection_url_entries: List[Entry] = [] diff --git a/src/ytdl_sub/downloaders/generic/validators.py b/src/ytdl_sub/downloaders/generic/validators.py index d2f425f4..6c172abc 100644 --- a/src/ytdl_sub/downloaders/generic/validators.py +++ b/src/ytdl_sub/downloaders/generic/validators.py @@ -173,7 +173,7 @@ class MultiUrlValidator(StrictDictValidator, AddsVariablesMixin): self._urls = self._validate_key(key="urls", validator=UrlListValidator) @property - def collection_urls(self) -> UrlListValidator: + def urls(self) -> UrlListValidator: """ Required. The Soundcloud user's url, i.e. ``soundcloud.com/the_username`` """ @@ -205,7 +205,7 @@ class MultiUrlValidator(StrictDictValidator, AddsVariablesMixin): ) # Apply formatting to each new source variable, ensure it resolves - for collection_url in self.collection_urls.list: + for collection_url in self.urls.list: for ( source_var_name, source_var_formatter_str, diff --git a/src/ytdl_sub/downloaders/youtube/merge_playlist.py b/src/ytdl_sub/downloaders/youtube/merge_playlist.py index 94712427..fdfffdaf 100644 --- a/src/ytdl_sub/downloaders/youtube/merge_playlist.py +++ b/src/ytdl_sub/downloaders/youtube/merge_playlist.py @@ -144,7 +144,7 @@ class YoutubeMergePlaylistDownloader(Downloader[YoutubeMergePlaylistDownloaderOp def download(self) -> List[Tuple[Entry, FileMetadata]]: """Download a single Youtube video, then split it into multiple videos""" - url = self.overrides.apply_formatter(self.collection.collection_urls.list[0].url) + url = self.overrides.apply_formatter(self.collection.urls.list[0].url) entry_dict = self.extract_info(url=url) merged_video = self._to_merged_video(entry_dict=entry_dict)