Compare commits
No commits in common. "984d8acc88b2d5b6b8af1e93124d5fe4299b3e58" and "f902e50018a0aaa1719f3dfa65d3517d1dbb8cda" have entirely different histories.
984d8acc88
...
f902e50018
2 changed files with 7 additions and 13 deletions
|
|
@ -86,7 +86,7 @@ def _scan_to_album(
|
||||||
_CD_SUBDIR = re.compile(r"^CD\d+$", re.IGNORECASE)
|
_CD_SUBDIR = re.compile(r"^CD\d+$", re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
def _rename_album_dir_inplace(input_dir: Path, album: Album) -> Path:
|
def _rename_album_dir_inplace(input_dir: Path, album: Album) -> None:
|
||||||
"""Benennt das Album-Wurzelverzeichnis nach den Metadaten um.
|
"""Benennt das Album-Wurzelverzeichnis nach den Metadaten um.
|
||||||
|
|
||||||
Muss als allerletzter Schritt aufgerufen werden, nachdem Tags,
|
Muss als allerletzter Schritt aufgerufen werden, nachdem Tags,
|
||||||
|
|
@ -97,9 +97,6 @@ def _rename_album_dir_inplace(input_dir: Path, album: Album) -> Path:
|
||||||
Umbenennung erfolgt automatisch.
|
Umbenennung erfolgt automatisch.
|
||||||
- Sonst (input_dir ist selbst das Album-Wurzelverzeichnis) → nur Hinweis
|
- Sonst (input_dir ist selbst das Album-Wurzelverzeichnis) → nur Hinweis
|
||||||
ausgeben, da ein Umbenennen des aktiven Verzeichnisses vermieden wird.
|
ausgeben, da ein Umbenennen des aktiven Verzeichnisses vermieden wird.
|
||||||
|
|
||||||
Returns:
|
|
||||||
Aktualisierter Pfad von input_dir nach dem Umbenennen.
|
|
||||||
"""
|
"""
|
||||||
abs_input = input_dir.resolve()
|
abs_input = input_dir.resolve()
|
||||||
desired = sanitize_filename(album.folder_name)
|
desired = sanitize_filename(album.folder_name)
|
||||||
|
|
@ -108,7 +105,7 @@ def _rename_album_dir_inplace(input_dir: Path, album: Album) -> Path:
|
||||||
# CD-Unterverzeichnis übergeben → Elternverzeichnis umbenennen
|
# CD-Unterverzeichnis übergeben → Elternverzeichnis umbenennen
|
||||||
album_root = abs_input.parent
|
album_root = abs_input.parent
|
||||||
if album_root.name == desired:
|
if album_root.name == desired:
|
||||||
return input_dir # bereits korrekt
|
return # bereits korrekt
|
||||||
new_path = album_root.parent / desired
|
new_path = album_root.parent / desired
|
||||||
if new_path.exists():
|
if new_path.exists():
|
||||||
typer.echo(
|
typer.echo(
|
||||||
|
|
@ -116,10 +113,9 @@ def _rename_album_dir_inplace(input_dir: Path, album: Album) -> Path:
|
||||||
"Verzeichnis nicht umbenannt.",
|
"Verzeichnis nicht umbenannt.",
|
||||||
err=True,
|
err=True,
|
||||||
)
|
)
|
||||||
return input_dir
|
return
|
||||||
album_root.rename(new_path)
|
album_root.rename(new_path)
|
||||||
typer.echo(f"Verzeichnis umbenannt: {album_root.name} → {desired}")
|
typer.echo(f"Verzeichnis umbenannt: {album_root.name} → {desired}")
|
||||||
return new_path / abs_input.name # z.B. .../Golden_Oldies_Vol_11/CD1
|
|
||||||
else:
|
else:
|
||||||
# Album-Wurzelverzeichnis direkt übergeben → nur Hinweis
|
# Album-Wurzelverzeichnis direkt übergeben → nur Hinweis
|
||||||
if abs_input.name != desired:
|
if abs_input.name != desired:
|
||||||
|
|
@ -127,7 +123,6 @@ def _rename_album_dir_inplace(input_dir: Path, album: Album) -> Path:
|
||||||
f"Tipp: Verzeichnis manuell umbenennen:\n"
|
f"Tipp: Verzeichnis manuell umbenennen:\n"
|
||||||
f" mv '{abs_input.name}' '{desired}'"
|
f" mv '{abs_input.name}' '{desired}'"
|
||||||
)
|
)
|
||||||
return input_dir
|
|
||||||
|
|
||||||
|
|
||||||
def _check_disc_counts_or_exit(album: Album, input_dir: Path, album_json: Path) -> None:
|
def _check_disc_counts_or_exit(album: Album, input_dir: Path, album_json: Path) -> None:
|
||||||
|
|
@ -305,7 +300,7 @@ def apply(
|
||||||
generate_playlist(album, album_dir)
|
generate_playlist(album, album_dir)
|
||||||
|
|
||||||
if in_place:
|
if in_place:
|
||||||
album_dir = _rename_album_dir_inplace(input_dir, album)
|
_rename_album_dir_inplace(input_dir, album)
|
||||||
|
|
||||||
typer.echo(f"Fertig! Album liegt in: {album_dir}")
|
typer.echo(f"Fertig! Album liegt in: {album_dir}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,11 +207,10 @@ def _stream_abcde(
|
||||||
stripped_hdr = line.strip()
|
stripped_hdr = line.strip()
|
||||||
print(f"\n {stripped_hdr}", flush=True)
|
print(f"\n {stripped_hdr}", flush=True)
|
||||||
# Album-Name zwischen den Strichen extrahieren (einmalig)
|
# Album-Name zwischen den Strichen extrahieren (einmalig)
|
||||||
# Zeile z.B.: "#1 (Musicbrainz): ---- Artist / Album ----"
|
|
||||||
if not detected_album:
|
if not detected_album:
|
||||||
inner_m = re.search(r"-{2,}\s*(.+?)\s*-{2,}", stripped_hdr)
|
inner = re.sub(r"^[-\s]+|[-\s]+$", "", stripped_hdr)
|
||||||
if inner_m:
|
if inner:
|
||||||
detected_album = inner_m.group(1).strip()
|
detected_album = inner
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# ── CDDB track lines "1: Artist - Title" or "1: Artist / Title"
|
# ── CDDB track lines "1: Artist - Title" or "1: Artist / Title"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue