dry-run actually dry running

This commit is contained in:
jbannon 2022-06-30 23:34:04 +00:00
parent 72af21745d
commit dd1e6d4dd6
3 changed files with 25 additions and 1 deletions

View file

@ -236,6 +236,8 @@ class Subscription:
If true, do not download any video/audio files or move anything to the output If true, do not download any video/audio files or move anything to the output
directory. directory.
""" """
self._enhanced_download_archive.reinitialize(dry_run=dry_run)
# TODO: Move this logic to separate function # TODO: Move this logic to separate function
# TODO: set id here as well # TODO: set id here as well
ytdl_options = copy.deepcopy(self.ytdl_options.dict) ytdl_options = copy.deepcopy(self.ytdl_options.dict)

View file

@ -350,6 +350,28 @@ class EnhancedDownloadArchive:
self._logger = Logger.get(name=subscription_name) self._logger = Logger.get(name=subscription_name)
def reinitialize(self, dry_run: bool) -> "EnhancedDownloadArchive":
"""
Re-initialize the enhanced download archive for successive downloads w/the same
subscription.
Parameters
----------
dry_run
Whether to actually move files to the output directory
Returns
-------
self
"""
self._file_handler = FileHandler(
working_directory=self.working_directory,
output_directory=self.output_directory,
dry_run=dry_run,
)
self._download_mapping = DownloadMappings()
return self
@property @property
def archive_file_name(self) -> str: def archive_file_name(self) -> str:
""" """

View file

@ -151,5 +151,5 @@ class TestPlaylistAsKodiMusicVideo:
def test_single_video_download( def test_single_video_download(
self, single_video_subscription, expected_single_video_download, output_directory self, single_video_subscription, expected_single_video_download, output_directory
): ):
single_video_subscription.download() single_video_subscription.download(dry_run=True)
expected_single_video_download.assert_files_exist(relative_directory=output_directory) expected_single_video_download.assert_files_exist(relative_directory=output_directory)