From 4b2bde5b4f3ad9e83850c25e79f6bfb2ebad40ac Mon Sep 17 00:00:00 2001 From: jbannon Date: Mon, 18 Jul 2022 00:49:52 +0000 Subject: [PATCH] tests updated --- src/ytdl_sub/downloaders/youtube/channel.py | 2 +- src/ytdl_sub/subscriptions/subscription.py | 4 ++++ .../youtube/test_channel_as_kodi_tv_show.py | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ytdl_sub/downloaders/youtube/channel.py b/src/ytdl_sub/downloaders/youtube/channel.py index 660c2052..1157e6a9 100644 --- a/src/ytdl_sub/downloaders/youtube/channel.py +++ b/src/ytdl_sub/downloaders/youtube/channel.py @@ -38,9 +38,9 @@ class YoutubeChannelDownloaderOptions(YoutubeDownloaderOptions, DateRangeValidat # optional channel_avatar_path: "poster.jpg" channel_banner_path: "fanart.jpg" + download_individually: True before: "now" after: "today-2weeks" - download_individually: True """ _required_keys = {"channel_url"} diff --git a/src/ytdl_sub/subscriptions/subscription.py b/src/ytdl_sub/subscriptions/subscription.py index 8dab4fdf..eb7476c9 100644 --- a/src/ytdl_sub/subscriptions/subscription.py +++ b/src/ytdl_sub/subscriptions/subscription.py @@ -292,6 +292,10 @@ class Subscription: entry=entry, entry_metadata=entry_metadata ) + # Re-save the download archive after each entry is moved to the output directory + if self.maintain_download_archive: + self._enhanced_download_archive.save_download_mappings() + downloader.post_download(overrides=self.overrides) for plugin in plugins: plugin.post_process_subscription() diff --git a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py b/tests/e2e/youtube/test_channel_as_kodi_tv_show.py index 3ccaa2fd..9f2f2bdc 100644 --- a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py +++ b/tests/e2e/youtube/test_channel_as_kodi_tv_show.py @@ -225,6 +225,7 @@ class TestChannelAsKodiTvShow: """ @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("download_individually", [True, False]) def test_full_channel_download( self, channel_subscription_generator, @@ -232,7 +233,10 @@ class TestChannelAsKodiTvShow: expected_full_channel_download, output_directory, dry_run, + download_individually, ): + channel_preset_dict["youtube"]["download_individually"] = download_individually + full_channel_subscription = channel_subscription_generator(preset_dict=channel_preset_dict) transaction_log = full_channel_subscription.download(dry_run=dry_run) assert_transaction_log_matches( @@ -244,6 +248,7 @@ class TestChannelAsKodiTvShow: expected_full_channel_download.assert_files_exist(relative_directory=output_directory) @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("download_individually", [True, False]) def test_recent_channel_download( self, channel_subscription_generator, @@ -251,7 +256,10 @@ class TestChannelAsKodiTvShow: expected_recent_channel_download, output_directory, dry_run, + download_individually, ): + recent_channel_preset_dict["youtube"]["download_individually"] = download_individually + recent_channel_subscription = channel_subscription_generator( preset_dict=recent_channel_preset_dict ) @@ -283,6 +291,7 @@ class TestChannelAsKodiTvShow: ) @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("download_individually", [True, False]) def test_recent_channel_download__no_vids_in_range( self, channel_subscription_generator, @@ -290,8 +299,11 @@ class TestChannelAsKodiTvShow: expected_recent_channel_no_vids_in_range_download, output_directory, dry_run, + download_individually, ): + recent_channel_preset_dict["youtube"]["download_individually"] = download_individually recent_channel_preset_dict["youtube"]["after"] = "21000101" + recent_channel_no_vids_in_range_subscription = channel_subscription_generator( preset_dict=recent_channel_preset_dict ) @@ -309,6 +321,7 @@ class TestChannelAsKodiTvShow: ) @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("download_individually", [True, False]) def test_rolling_recent_channel_download( self, channel_subscription_generator, @@ -318,7 +331,13 @@ class TestChannelAsKodiTvShow: expected_rolling_recent_channel_download, output_directory, dry_run, + download_individually, ): + recent_channel_preset_dict["youtube"]["download_individually"] = download_individually + rolling_recent_channel_preset_dict["youtube"][ + "download_individually" + ] = download_individually + recent_channel_subscription = channel_subscription_generator( preset_dict=recent_channel_preset_dict )