diff --git a/src/ytdl_sub/downloaders/downloader.py b/src/ytdl_sub/downloaders/downloader.py index f9712ccf..84fa9a6f 100644 --- a/src/ytdl_sub/downloaders/downloader.py +++ b/src/ytdl_sub/downloaders/downloader.py @@ -422,7 +422,7 @@ class Downloader(DownloadArchiver, Generic[DownloaderOptionsT], ABC): FileHandler.delete(file_path=archive_path) # If the archive file did exist, restore the backup elif archive_file_exists: - FileHandler.copy(src_file_path=backup_archive_path, dst_file_path=archive_path) + FileHandler.move(src_file_path=backup_archive_path, dst_file_path=archive_path) # Clear info json files if true if clear_info_json_files: diff --git a/src/ytdl_sub/subscriptions/subscription_download.py b/src/ytdl_sub/subscriptions/subscription_download.py index 38424792..58e65871 100644 --- a/src/ytdl_sub/subscriptions/subscription_download.py +++ b/src/ytdl_sub/subscriptions/subscription_download.py @@ -137,6 +137,8 @@ class SubscriptionDownload(BaseSubscription, ABC): self._enhanced_download_archive.remove_stale_files(date_range=date_range_to_keep) self._enhanced_download_archive.save_download_mappings() + FileHandler.delete(self._enhanced_download_archive.archive_working_file_path) + FileHandler.delete(self._enhanced_download_archive.mapping_working_file_path) @contextlib.contextmanager def _subscription_download_context_managers(self) -> None: diff --git a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py index cbb3b211..a5e1ce37 100644 --- a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py +++ b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py @@ -400,8 +400,9 @@ class EnhancedDownloadArchive: Returns ------- The download archive's file name (no path) + Used to recreate yt-dlp's download archive in the working directory """ - return f".ytdl-subscribe-{self.subscription_name}-download-archive.txt" + return f".ytdl-sub-{self.subscription_name}-download-archive.txt" @property def working_directory(self) -> str: @@ -440,7 +441,7 @@ class EnhancedDownloadArchive: return str(Path(self.output_directory) / self._mapping_file_name) @property - def _mapping_working_file_path(self) -> str: + def mapping_working_file_path(self) -> str: """ Returns ------- @@ -449,7 +450,7 @@ class EnhancedDownloadArchive: return str(Path(self.working_directory) / self._mapping_file_name) @property - def _archive_working_file_path(self) -> str: + def archive_working_file_path(self) -> str: """ Returns ------- @@ -503,7 +504,7 @@ class EnhancedDownloadArchive: return self # Otherwise, create a ytdl download archive file in the working directory. - self.mapping.to_download_archive().to_file(self._archive_working_file_path) + self.mapping.to_download_archive().to_file(self.archive_working_file_path) return self @@ -555,7 +556,7 @@ class EnhancedDownloadArchive: self """ if not self.get_file_handler_transaction_log().is_empty: - self._download_mapping.to_file(output_json_file=self._mapping_working_file_path) + self._download_mapping.to_file(output_json_file=self.mapping_working_file_path) self.save_file_to_output_directory(file_name=self._mapping_file_name) return self