added in a pattern match for album folders in 'artist - album' format

This commit is contained in:
rembo10
2014-04-05 22:43:39 -07:00
parent a59ed331a8
commit ea6e3335a3
2 changed files with 13 additions and 2 deletions

View File

@@ -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<name>[^:]+)\s*-(?P<album>.*?)\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)

View File

@@ -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'])