[BUGFIX] Fix playlists not downloading correctly

Due to url ytdl-options not materializing
This commit is contained in:
Jesse Bannon 2024-10-25 20:47:18 -07:00 committed by GitHub
parent 7676fd9488
commit 88110a816d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 6 deletions

View file

@ -1,7 +1,9 @@
from typing import Any
from typing import Dict
from typing import Optional
from ytdl_sub.config.defaults import DEFAULT_DOWNLOAD_ARCHIVE_NAME
from ytdl_sub.config.overrides import Overrides
from ytdl_sub.validators.file_path_validators import OverridesStringFormatterFilePathValidator
from ytdl_sub.validators.file_path_validators import StringFormatterFileNameValidator
from ytdl_sub.validators.strict_dict_validator import StrictDictValidator
@ -48,6 +50,16 @@ class YTDLOptions(UnstructuredOverridesDictFormatterValidator):
where each key is a ytdl argument. Include in the example are some popular ytdl_options.
"""
def to_native_dict(self, overrides: Overrides) -> Dict:
"""
Materializes the entire ytdl-options dict from OverrideStringFormatters into
native python
"""
return {
key: overrides.apply_overrides_formatter_to_native(val)
for key, val in self.dict.items()
}
# Disable for proper docstring formatting
# pylint: disable=line-too-long

View file

@ -457,7 +457,7 @@ class MultiUrlDownloader(SourcePlugin[MultiUrlValidator]):
def _download_metadata(self, url: str, validator: UrlValidator) -> Iterable[Entry]:
metadata_ytdl_options = self.metadata_ytdl_options(
ytdl_option_overrides=validator.ytdl_options.dict
ytdl_option_overrides=validator.ytdl_options.to_native_dict(self.overrides)
)
download_reversed = ScriptUtils.bool_formatter_output(
self.overrides.apply_formatter(validator.download_reverse)

View file

@ -110,11 +110,7 @@ class SubscriptionYTDLOptions:
@property
def _user_ytdl_options(self) -> Dict:
native_ytdl_options = {
key: self._overrides.apply_overrides_formatter_to_native(val)
for key, val in self._preset.ytdl_options.dict.items()
}
return native_ytdl_options
return self._preset.ytdl_options.to_native_dict(self._overrides)
@property
def _plugin_match_filters(self) -> Dict: