Fix organizer: omit empty artist suffix in filenames
Same fix as ripper: when track.artist and album.artist are both empty, the filename now ends with just the title instead of '_-_.flac'. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de12afa67a
commit
90713452c2
1 changed files with 6 additions and 2 deletions
|
|
@ -131,8 +131,12 @@ def build_mapping(
|
|||
|
||||
for audio_file, track in zip(audio_files, disc.tracks):
|
||||
safe_title = sanitize_filename(track.title)
|
||||
safe_artist = sanitize_filename(track.artist or album.artist)
|
||||
new_name = f"{track.track_number:02d}_-_{safe_title}_-_{safe_artist}{audio_file.suffix}"
|
||||
artist_raw = track.artist or album.artist
|
||||
if artist_raw:
|
||||
safe_artist = sanitize_filename(artist_raw)
|
||||
new_name = f"{track.track_number:02d}_-_{safe_title}_-_{safe_artist}{audio_file.suffix}"
|
||||
else:
|
||||
new_name = f"{track.track_number:02d}_-_{safe_title}{audio_file.suffix}"
|
||||
mapping[audio_file] = target_dir / new_name
|
||||
|
||||
return mapping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue