From 68e715f18e3917f25ae14b85e55c13234ebfebe4 Mon Sep 17 00:00:00 2001 From: tcely Date: Thu, 7 Aug 2025 22:27:07 -0400 Subject: [PATCH] Do not rename the current `Media.media_file` --- tubesync/sync/models/media.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/models/media.py b/tubesync/sync/models/media.py index b60a4b67..2a351a5a 100644 --- a/tubesync/sync/models/media.py +++ b/tubesync/sync/models/media.py @@ -1151,6 +1151,8 @@ class Media(models.Model): other_path.replace(new_file_path) for fuzzy_path in fuzzy_paths: + if not fuzzy_path.exists(): + continue (fuzzy_prefix_path, fuzzy_stem) = directory_and_stem(fuzzy_path, True) old_file_str = fuzzy_path.name new_file_str = new_stem + old_file_str[len(fuzzy_stem):] @@ -1159,7 +1161,7 @@ class Media(models.Model): continue log.debug(f'Considering rename for: {self!s}\n\t{fuzzy_path!s}\n\t{new_file_path!s}') # it quite possibly was renamed already - if fuzzy_path.exists() and not new_file_path.exists(): + if not (new_video_path.samefile(fuzzy_path) or new_file_path.exists()): log.debug(f'{self!s}: {fuzzy_path!s} => {new_file_path!s}') fuzzy_path.rename(new_file_path)