From d460139b45186e82d00dbc3dd261e9118cd6087b Mon Sep 17 00:00:00 2001 From: Will Burden <25230174+willburden@users.noreply.github.com> Date: Sat, 13 Dec 2025 00:14:14 +0000 Subject: [PATCH] Store new path only after successful write --- beetsplug/replace.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beetsplug/replace.py b/beetsplug/replace.py index 532cc3d5b..0c9eb29cd 100644 --- a/beetsplug/replace.py +++ b/beetsplug/replace.py @@ -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.")