fix: make album tagging best-effort per file
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ class MutagenTagger:
|
||||
|
||||
names = os.listdir(album_dir)
|
||||
for old_name, new_name, title, number in plan_track_names(names, target.tracklist):
|
||||
try:
|
||||
path = os.path.join(album_dir, old_name)
|
||||
audio = mutagen.File(path, easy=True)
|
||||
if audio is None: # unreadable/unsupported file — leave it untouched
|
||||
@@ -46,3 +47,6 @@ class MutagenTagger:
|
||||
new_path = os.path.join(album_dir, new_name)
|
||||
if os.path.abspath(new_path) != os.path.abspath(path) and not os.path.exists(new_path):
|
||||
os.rename(path, new_path)
|
||||
except Exception as e: # best-effort: one bad track must not block the rest of the album
|
||||
print(f"tagger: failed to tag {old_name} in {album_dir}: {e}", flush=True)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user