diff --git a/headphones/helpers.py b/headphones/helpers.py index bc802068..29f23aeb 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -312,6 +312,17 @@ def extract_data(s): album = match.group("album") year = match.group("year") return (name, album, year) + + #Gonna take a guess on this one - might be enough to search on mb + # TODO: add in a bunch of re pattern matches + pat = re.compile(r"\s*(?P[^:]+)\s*-(?P.*?)\s*$") + match = pat.match(s) + if match: + name = match.group("name") + album = match.group("album") + year = None + return (name, album, year) + else: return (None, None, None) diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index efa7a19e..1129ce5b 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -1020,7 +1020,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None): except Exception as e: name = album = year = None - if name and album and year: + if name and album: release = myDB.action('SELECT AlbumID, ArtistName, AlbumTitle from albums WHERE ArtistName LIKE ? and AlbumTitle LIKE ?', [name, album]).fetchone() if release: logger.info('Found a match in the database: %s - %s. Verifying to make sure it is the correct album', release['ArtistName'], release['AlbumTitle']) @@ -1048,7 +1048,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None): except Exception as e: name = album = year = None - if name and album and year: + if name and album: release = myDB.action('SELECT AlbumID, ArtistName, AlbumTitle from albums WHERE ArtistName LIKE ? and AlbumTitle LIKE ?', [name, album]).fetchone() if release: logger.info('Found a match in the database: %s - %s. Verifying to make sure it is the correct album', release['ArtistName'], release['AlbumTitle'])