Fix file importing

Imported track wasn't moved to destination
This commit is contained in:
Keith Edmunds 2024-05-06 12:12:56 +01:00
parent e25d4ad311
commit d050fa0d84

View File

@ -184,15 +184,16 @@ class ImportTrack(QObject):
f"Importing {basename(tf.source_file_path)}", 5000
)
# Sanity check
if not os.path.exists(tf.source_file_path):
log.error(f"ImportTrack: file not found: {tf.source_file_path=}")
continue
# Move the track file. Check that we're not importing a
# file that's already in its final destination.
if (
os.path.exists(tf.track_path)
and os.path.exists(tf.source_file_path)
and tf.track_path != tf.source_file_path
):
if os.path.exists(tf.track_path) and tf.track_path != tf.source_file_path:
os.unlink(tf.track_path)
shutil.move(tf.source_file_path, tf.track_path)
shutil.move(tf.source_file_path, tf.track_path)
# Import track
try: