From 287eb8ac811ff457f9df4bcafa8f145e024c33a2 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Thu, 8 Sep 2022 10:46:48 -0700 Subject: [PATCH] do not write as modified if it was added --- src/ytdl_sub/utils/file_handler.py | 11 +++++++---- .../plugins/date_range/test_channel_recent.txt | 5 +---- .../soundcloud/test_soundcloud_discography.txt | 5 +---- .../youtube/test_channel_full.txt | 5 +---- .../youtube/test_playlist.txt | 5 +---- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/ytdl_sub/utils/file_handler.py b/src/ytdl_sub/utils/file_handler.py index e3d087f5..a1fa97d5 100644 --- a/src/ytdl_sub/utils/file_handler.py +++ b/src/ytdl_sub/utils/file_handler.py @@ -348,15 +348,18 @@ class FileHandler: source_file_path = Path(self.working_directory) / file_name output_file_path = Path(self.output_directory) / output_file_name - # output file exists, see if we modify it - if os.path.isfile(output_file_path): + # output file exists, and it's not marked as created already, see if we modify it + if ( + os.path.isfile(output_file_path) + and output_file_name not in self.file_handler_transaction_log.files_created + ): if not files_equal(source_file_path, output_file_path): - self._file_handler_transaction_log.log_modified_file( + self.file_handler_transaction_log.log_modified_file( file_name=output_file_name, file_metadata=file_metadata ) # output file does not already exist, creates a new file else: - self._file_handler_transaction_log.log_created_file( + self.file_handler_transaction_log.log_created_file( file_name=output_file_name, file_metadata=file_metadata ) diff --git a/tests/e2e/resources/transaction_log_summaries/plugins/date_range/test_channel_recent.txt b/tests/e2e/resources/transaction_log_summaries/plugins/date_range/test_channel_recent.txt index 4b2d9005..9ad2da30 100644 --- a/tests/e2e/resources/transaction_log_summaries/plugins/date_range/test_channel_recent.txt +++ b/tests/e2e/resources/transaction_log_summaries/plugins/date_range/test_channel_recent.txt @@ -53,7 +53,4 @@ tvshow.nfo NFO tags: tvshow: plot: Plugin and map updates for the server Project Zombie. - title: Project / Zombie -Files modified in '{output_directory}' ----------------------------------------- -.ytdl-sub-recent-download-archive.json \ No newline at end of file + title: Project / Zombie \ No newline at end of file diff --git a/tests/e2e/resources/transaction_log_summaries/soundcloud/test_soundcloud_discography.txt b/tests/e2e/resources/transaction_log_summaries/soundcloud/test_soundcloud_discography.txt index c070302a..f34f9c00 100644 --- a/tests/e2e/resources/transaction_log_summaries/soundcloud/test_soundcloud_discography.txt +++ b/tests/e2e/resources/transaction_log_summaries/soundcloud/test_soundcloud_discography.txt @@ -133,7 +133,4 @@ j_b/[2022] Acoustic Treats/11 - Untold History.mp3 title: Untold History track: 11 year: 2022 -j_b/[2022] Acoustic Treats/folder.jpg -Files modified in '{output_directory}' ----------------------------------------- -.ytdl-sub-jb-download-archive.json \ No newline at end of file +j_b/[2022] Acoustic Treats/folder.jpg \ No newline at end of file diff --git a/tests/e2e/resources/transaction_log_summaries/youtube/test_channel_full.txt b/tests/e2e/resources/transaction_log_summaries/youtube/test_channel_full.txt index 1e5dc4e6..685e186c 100644 --- a/tests/e2e/resources/transaction_log_summaries/youtube/test_channel_full.txt +++ b/tests/e2e/resources/transaction_log_summaries/youtube/test_channel_full.txt @@ -285,7 +285,4 @@ tvshow.nfo tvshow: plot: Plugin and map updates for the server Project Zombie. source_uploader: Project Zombie - title: Project / Zombie -Files modified in '{output_directory}' ----------------------------------------- -.ytdl-sub-pz-download-archive.json \ No newline at end of file + title: Project / Zombie \ No newline at end of file diff --git a/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt b/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt index b067edc1..14e1f17f 100644 --- a/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt +++ b/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt @@ -36,7 +36,4 @@ tvshow.nfo test: source_description: Trailers, Updates, etc source_title: Jesse's Minecraft Server - source_uploader: Project Zombie -Files modified in '{output_directory}' ----------------------------------------- -.ytdl-sub-music_video_playlist_test-download-archive.json \ No newline at end of file + source_uploader: Project Zombie \ No newline at end of file