mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 12:49:26 +00:00
added in a pattern match for album folders in 'artist - album' format
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user