From 0c0311b00f25b06e4cfb5d6ab0fcdb2d13f44fa2 Mon Sep 17 00:00:00 2001 From: dschlueter Date: Wed, 18 Feb 2026 10:32:35 +0100 Subject: [PATCH] Fix CDDB album name extraction from header line The header line can have a prefix before the dashes, e.g.: "#1 (Musicbrainz): ---- Artist / Album ----" Use regex search for content between ---- markers instead of stripping leading/trailing dashes from the full line. Co-Authored-By: Claude Opus 4.6 --- src/musiksammlung/ripper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/musiksammlung/ripper.py b/src/musiksammlung/ripper.py index c85197f..b1be88f 100644 --- a/src/musiksammlung/ripper.py +++ b/src/musiksammlung/ripper.py @@ -207,10 +207,11 @@ def _stream_abcde( stripped_hdr = line.strip() print(f"\n {stripped_hdr}", flush=True) # Album-Name zwischen den Strichen extrahieren (einmalig) + # Zeile z.B.: "#1 (Musicbrainz): ---- Artist / Album ----" if not detected_album: - inner = re.sub(r"^[-\s]+|[-\s]+$", "", stripped_hdr) - if inner: - detected_album = inner + inner_m = re.search(r"-{2,}\s*(.+?)\s*-{2,}", stripped_hdr) + if inner_m: + detected_album = inner_m.group(1).strip() continue # ── CDDB track lines "1: Artist - Title" or "1: Artist / Title"