test wip
This commit is contained in:
parent
85111b9367
commit
b8dd8bea5f
2 changed files with 62 additions and 13 deletions
|
|
@ -349,6 +349,30 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
|||
|
||||
return self.download_archive.get_file_handler_transaction_log()
|
||||
|
||||
def get_ytdl_options(self, plugins: Optional[List[Plugin]], dry_run: bool) -> SubscriptionYTDLOptions:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
plugins
|
||||
Optional. If not provided, will reinitialize them
|
||||
|
||||
Returns
|
||||
-------
|
||||
SubscriptionYTDLOptions
|
||||
Both metadata and download ytdl-options
|
||||
"""
|
||||
if plugins is None:
|
||||
plugins = self._initialize_plugins()
|
||||
|
||||
return SubscriptionYTDLOptions(
|
||||
preset=self._preset_options,
|
||||
plugins=plugins,
|
||||
enhanced_download_archive=self.download_archive,
|
||||
overrides=self.overrides,
|
||||
working_directory=self.working_directory,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
||||
def download(self, dry_run: bool = False) -> FileHandlerTransactionLog:
|
||||
"""
|
||||
Performs the subscription download
|
||||
|
|
@ -368,13 +392,9 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
|||
logging.info("Skipping %s", self.name)
|
||||
return FileHandlerTransactionLog()
|
||||
|
||||
subscription_ytdl_options = SubscriptionYTDLOptions(
|
||||
preset=self._preset_options,
|
||||
subscription_ytdl_options = self.get_ytdl_options(
|
||||
plugins=plugins,
|
||||
enhanced_download_archive=self.download_archive,
|
||||
overrides=self.overrides,
|
||||
working_directory=self.working_directory,
|
||||
dry_run=dry_run,
|
||||
dry_run=dry_run
|
||||
)
|
||||
|
||||
downloader = MultiUrlDownloader(
|
||||
|
|
@ -420,14 +440,9 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
|||
self.download_archive.reinitialize(dry_run=dry_run)
|
||||
|
||||
plugins = self._initialize_plugins()
|
||||
|
||||
subscription_ytdl_options = SubscriptionYTDLOptions(
|
||||
preset=self._preset_options,
|
||||
subscription_ytdl_options = self.get_ytdl_options(
|
||||
plugins=plugins,
|
||||
enhanced_download_archive=self.download_archive,
|
||||
overrides=self.overrides,
|
||||
working_directory=self.working_directory,
|
||||
dry_run=dry_run,
|
||||
dry_run=dry_run
|
||||
)
|
||||
|
||||
# Re-add the original downloader class' plugins
|
||||
|
|
|
|||
34
tests/integration/plugins/test_date_range.py
Normal file
34
tests/integration/plugins/test_date_range.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from ytdl_sub.subscriptions.subscription import Subscription
|
||||
from ytdl_sub.utils.exceptions import ValidationException
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def single_song_video_dict(output_directory):
|
||||
return {
|
||||
"download": "https://your.name.here",
|
||||
"output_options": {"output_directory": output_directory, "file_name": "will_error.mp4"},
|
||||
# test multi-tags compile
|
||||
"music_tags": {"genres": ["multi_tag_1", "multi_tag_2"]},
|
||||
}
|
||||
|
||||
|
||||
class TestDateRange:
|
||||
def test_date_range(
|
||||
self,
|
||||
config,
|
||||
single_song_video_dict,
|
||||
output_directory,
|
||||
subscription_name,
|
||||
mock_download_collection_entries,
|
||||
):
|
||||
ytdl_options = Subscription.from_dict(
|
||||
config=config,
|
||||
preset_name=subscription_name,
|
||||
preset_dict=single_song_video_dict,
|
||||
).get_ytdl_options(plugins=None, dry_run=False)
|
||||
|
||||
assert ytdl_options.download_builder().to_dict() is False
|
||||
Loading…
Reference in a new issue