feat: auto-rename album directory after in-place apply
After all file operations (rename, tag, cover, playlist), apply now renames the album root directory to match album.json metadata: - input_dir = CD1/CD2 etc.: parent directory is renamed automatically e.g. Kärntner_Doppelsextett/ → Du_Berührst_Mi_20_Jahre_Kärntner_Doppelsextett/ - input_dir = album root: a hint with the mv command is printed instead (avoids renaming an actively used path) - Existing directory with target name: warning, no rename Also: _sanitize_filename() in organizer.py made public (sanitize_filename), used consistently across organizer, playlist and cli modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c0e4d2aa85
commit
7554cade50
5 changed files with 148 additions and 20 deletions
|
|
@ -6,7 +6,7 @@ import logging
|
|||
from pathlib import Path
|
||||
|
||||
from musiksammlung.models import Album
|
||||
from musiksammlung.organizer import _sanitize_filename
|
||||
from musiksammlung.organizer import sanitize_filename
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ def generate_playlist(album: Album, album_dir: Path) -> Path:
|
|||
Returns:
|
||||
Pfad zur erzeugten Playlist-Datei.
|
||||
"""
|
||||
playlist_name = _sanitize_filename(album.album) + ".m3u"
|
||||
playlist_name = sanitize_filename(album.album) + ".m3u"
|
||||
playlist_path = album_dir / playlist_name
|
||||
multi_disc = len(album.discs) > 1
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ def generate_playlist(album: Album, album_dir: Path) -> Path:
|
|||
disc_prefix = ""
|
||||
|
||||
for track in disc.tracks:
|
||||
safe_title = _sanitize_filename(track.title)
|
||||
safe_title = sanitize_filename(track.title)
|
||||
# Audiodatei im Zielverzeichnis finden
|
||||
pattern = f"{track.track_number:02d}_-_{safe_title}*"
|
||||
if multi_disc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue