From 6ae655ad7a83ce7e86b3d859f3cf6289ee3b82e7 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Fri, 4 Apr 2014 19:45:35 +0200 Subject: [PATCH] Fixed the album number detection. Added more debugging --- headphones/helpers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/headphones/helpers.py b/headphones/helpers.py index f53f03a3..21e8f27e 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -25,7 +25,7 @@ import headphones # Modified from https://github.com/Verrus/beets-plugin-featInTitle RE_FEATURING = re.compile(r"[fF]t\.|[fF]eaturing|[fF]eat\.|\b[wW]ith\b|&|vs\.") -RE_CD_ALBUM = re.compile(r"\(?((CD|disc)\s*[0-9]+)\)", re.I) +RE_CD_ALBUM = re.compile(r"\(?((CD|disc)\s*[0-9]+)\)?", re.I) RE_CD = re.compile(r"^(CD|dics)\s*[0-9]+$", re.I) def multikeysort(items, columns): @@ -375,8 +375,11 @@ def extract_metadata(f): # Replace occurences of e.g. CD1 for index, album in enumerate(new_albums): if RE_CD_ALBUM.search(album): + old_album = new_albums[index] new_albums[index] = RE_CD_ALBUM.sub("", album).strip() + logger.debug("Stripped albumd number identifier: %s -> %s" % (old_album, new_albums[index])) + # Remove duplicates new_albums = list(set(new_albums)) @@ -405,7 +408,9 @@ def extract_metadata(f): return (artist, albums[0], years[0]) # Not sure what to do here. - logger.info("Found %d artists, %d albums and %d years in metadata, ignoring" % (len(artists), len(albums), len(years))) + logger.info("Found %d artists, %d albums and %d years in metadata, so ignoring" % (len(artists), len(albums), len(years))) + logger.debug("Artists: %s, Albums: %s, Years: %s" % (artists, albums, years)) + return (None, None, None) def extract_logline(s):