Skip to content

Commit f51087f

Browse files
authored
Merge pull request #1263 from tcely/patch-2
Do not rename the current `Media.media_file`
2 parents cff4608 + 68e715f commit f51087f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tubesync/sync/models/media.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,8 @@ def rename_files(self):
11511151
other_path.replace(new_file_path)
11521152

11531153
for fuzzy_path in fuzzy_paths:
1154+
if not fuzzy_path.exists():
1155+
continue
11541156
(fuzzy_prefix_path, fuzzy_stem) = directory_and_stem(fuzzy_path, True)
11551157
old_file_str = fuzzy_path.name
11561158
new_file_str = new_stem + old_file_str[len(fuzzy_stem):]
@@ -1159,7 +1161,7 @@ def rename_files(self):
11591161
continue
11601162
log.debug(f'Considering rename for: {self!s}\n\t{fuzzy_path!s}\n\t{new_file_path!s}')
11611163
# it quite possibly was renamed already
1162-
if fuzzy_path.exists() and not new_file_path.exists():
1164+
if not (new_video_path.samefile(fuzzy_path) or new_file_path.exists()):
11631165
log.debug(f'{self!s}: {fuzzy_path!s} => {new_file_path!s}')
11641166
fuzzy_path.rename(new_file_path)
11651167

0 commit comments

Comments
 (0)