mirror of
https://github.com/beetbox/beets.git
synced 2026-03-28 16:25:19 +01:00
Store new path only after successful write
This commit is contained in:
parent
2d0c48757e
commit
d460139b45
1 changed files with 4 additions and 2 deletions
|
|
@ -125,9 +125,8 @@ class ReplacePlugin(BeetsPlugin):
|
|||
except Exception as e:
|
||||
raise ui.UserError(f"Could not delete original file: {e}")
|
||||
|
||||
# Store the new path in the database.
|
||||
# Update the path to point to the new file.
|
||||
song.path = str(dest).encode()
|
||||
song.store()
|
||||
|
||||
# Write the metadata in the database to the song file's tags.
|
||||
try:
|
||||
|
|
@ -135,4 +134,7 @@ class ReplacePlugin(BeetsPlugin):
|
|||
except Exception as e:
|
||||
raise ui.UserError(f"Error writing metadata to file: {e}")
|
||||
|
||||
# Commit the new path to the database.
|
||||
song.store()
|
||||
|
||||
ui.print_("Replacement successful.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue