mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01: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")
|
album = match.group("album")
|
||||||
year = match.group("year")
|
year = match.group("year")
|
||||||
return (name, album, 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:
|
else:
|
||||||
return (None, None, None)
|
return (None, None, None)
|
||||||
|
|
||||||
|
|||||||
@@ -1020,7 +1020,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
name = album = year = None
|
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()
|
release = myDB.action('SELECT AlbumID, ArtistName, AlbumTitle from albums WHERE ArtistName LIKE ? and AlbumTitle LIKE ?', [name, album]).fetchone()
|
||||||
if release:
|
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'])
|
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:
|
except Exception as e:
|
||||||
name = album = year = None
|
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()
|
release = myDB.action('SELECT AlbumID, ArtistName, AlbumTitle from albums WHERE ArtistName LIKE ? and AlbumTitle LIKE ?', [name, album]).fetchone()
|
||||||
if release:
|
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'])
|
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