diff --git a/docs/config.rst b/docs/config.rst index 0927bee5..ada53acb 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -114,7 +114,7 @@ for available source variables to use. albums_and_singles __________________ .. autoclass:: ytdl_sub.downloaders.soundcloud.albums_and_singles.SoundcloudAlbumsAndSinglesDownloadOptions() - :members: + :members: url, skip_premiere_tracks :member-order: bysource :inherited-members: diff --git a/src/ytdl_sub/config/preset.py b/src/ytdl_sub/config/preset.py index 4a4554ca..af8880e0 100644 --- a/src/ytdl_sub/config/preset.py +++ b/src/ytdl_sub/config/preset.py @@ -233,7 +233,11 @@ class Preset(StrictDictValidator): # If the formatter supports source variables, set the formatter variables to include # both source and override variables if not isinstance(formatter_validator, OverridesStringFormatterValidator): - source_variables = {source_var: "dummy_string" for source_var in self._source_variables} + source_variables = { + source_var: "dummy_string" + for source_var in self._source_variables + + self.downloader_options.added_source_variables() + } variable_dict = dict(source_variables, **variable_dict) # For all plugins, add in any extra added source variables diff --git a/src/ytdl_sub/downloaders/soundcloud/albums_and_singles.py b/src/ytdl_sub/downloaders/soundcloud/albums_and_singles.py index 2a669fed..f40fbfcf 100644 --- a/src/ytdl_sub/downloaders/soundcloud/albums_and_singles.py +++ b/src/ytdl_sub/downloaders/soundcloud/albums_and_singles.py @@ -1,12 +1,12 @@ from typing import Dict from typing import Generator +from typing import List from ytdl_sub.downloaders.downloader import Downloader from ytdl_sub.downloaders.downloader import DownloaderValidator from ytdl_sub.downloaders.generic.collection import CollectionDownloader from ytdl_sub.downloaders.generic.collection import CollectionDownloadOptions from ytdl_sub.entries.entry import Entry -from ytdl_sub.entries.soundcloud import SoundcloudTrack from ytdl_sub.validators.url_validator import SoundcloudUsernameUrlValidator from ytdl_sub.validators.validators import BoolValidator @@ -87,12 +87,24 @@ class SoundcloudAlbumsAndSinglesDownloadOptions(DownloaderValidator): """ return self._url + def added_source_variables(self) -> List[str]: + """Validate using collection_validator""" + return self.collection_validator.added_source_variables() + + def validate_with_variables( + self, source_variables: List[str], override_variables: Dict[str, str] + ) -> None: + """Validate using collection_validator""" + return self.collection_validator.validate_with_variables( + source_variables, override_variables + ) + class SoundcloudAlbumsAndSinglesDownloader( - Downloader[SoundcloudAlbumsAndSinglesDownloadOptions, SoundcloudTrack] + Downloader[SoundcloudAlbumsAndSinglesDownloadOptions, Entry] ): downloader_options_type = SoundcloudAlbumsAndSinglesDownloadOptions - downloader_entry_type = SoundcloudTrack + downloader_entry_type = Entry supports_subtitles = False supports_chapters = False @@ -125,7 +137,7 @@ class SoundcloudAlbumsAndSinglesDownloader( return False - def download(self) -> Generator[SoundcloudTrack, None, None]: + def download(self) -> Generator[Entry, None, None]: """ Soundcloud subscription to download albums and tracks as singles. """