From 29b73ee299247e382cff5465540d377a72d35cb6 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 3 Oct 2023 12:41:35 -0700 Subject: [PATCH] asdf --- src/ytdl_sub/config/preset_options.py | 5 +++-- src/ytdl_sub/ytdl_additions/enhanced_download_archive.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ytdl_sub/config/preset_options.py b/src/ytdl_sub/config/preset_options.py index 25cfa0db..858068f5 100644 --- a/src/ytdl_sub/config/preset_options.py +++ b/src/ytdl_sub/config/preset_options.py @@ -368,8 +368,9 @@ class OutputOptions(StrictDictValidator): def migrated_download_archive_name(self) -> Optional[OverridesStringFormatterValidator]: """ Optional. Intended to be used if you are migrating a subscription with either a new - subscription name or output directory. If ``download_archive_name`` cannot be found, - it will try to find the + subscription name or output directory. It will try to load the archive file using this name + first, and fallback to ``download_archive_name``. It will always save to this file + and remove the original ``download_archive_name``. """ return self._migrated_download_archive_name diff --git a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py index 787c190c..f8e4ff2f 100644 --- a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py +++ b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py @@ -371,7 +371,7 @@ class EnhancedDownloadArchive: if os.path.isfile(migrated_mapping_file_path): logger.warning( "Loading migrated archive file, can now replace " - "`output_options.download_archive` value with the contents of " + "`output_options.download_archive` with the contents of " "`output_options.migrated_download_archive`" ) return DownloadMappings.from_file(migrated_mapping_file_path) @@ -578,8 +578,9 @@ class EnhancedDownloadArchive: self.save_file_to_output_directory( file_name=self.file_name, output_file_name=self._migrated_file_name ) - # and delete the old one - self.delete_file_from_output_directory(file_name=self.file_name) + # and delete the old one if the name differs + if self._file_name != self._migrated_file_name: + self.delete_file_from_output_directory(file_name=self.file_name) # Otherwise, only save if there are changes to the transaction log elif not self.get_file_handler_transaction_log().is_empty: self._download_mapping.to_file(output_json_file=self.working_file_path)