mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-18 02:49:26 +01:00
Better fix for hang on mb artist/album lookup. Took out string filter from searcher
This commit is contained in:
@@ -48,7 +48,12 @@ def scanMusic(dir=None):
|
||||
else:
|
||||
continue
|
||||
|
||||
myDB.action('INSERT INTO have VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?)', [artist, f.album, f.track, f.title, f.length, f.bitrate, f.genre, f.date, f.mb_trackid])
|
||||
if not f.album:
|
||||
album = None
|
||||
else:
|
||||
album = f.album
|
||||
|
||||
myDB.action('INSERT INTO have VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?)', [artist, album, f.track, f.title, f.length, f.bitrate, f.genre, f.date, f.mb_trackid])
|
||||
|
||||
# Get the average bitrate if the option is selected
|
||||
if headphones.DETECT_BITRATE:
|
||||
|
||||
@@ -400,7 +400,7 @@ def findArtistbyAlbum(name):
|
||||
|
||||
myDB = db.DBConnection()
|
||||
|
||||
artist = myDB.action('SELECT AlbumTitle from have WHERE ArtistName=? AND AlbumTitle IS NOT NULL', [name]).fetchone()
|
||||
artist = myDB.action('SELECT AlbumTitle from have WHERE ArtistName=? AND AlbumTitle IS NOT NULL ORDER BY RANDOM()', [name]).fetchone()
|
||||
|
||||
if not artist:
|
||||
return False
|
||||
|
||||
@@ -437,17 +437,17 @@ def verifyresult(title, artistterm, term):
|
||||
|
||||
title = re.sub('[\.\-\/\_]', ' ', title)
|
||||
|
||||
if artistterm != 'Various Artists':
|
||||
|
||||
if not re.search('^' + re.escape(artistterm), title, re.IGNORECASE):
|
||||
logger.info("Removed from results: " + title + " (artist not at string start).")
|
||||
return False
|
||||
elif re.search(re.escape(artistterm) + '\w', title, re.IGNORECASE | re.UNICODE):
|
||||
logger.info("Removed from results: " + title + " (post substring result).")
|
||||
return False
|
||||
elif re.search('\w' + re.escape(artistterm), title, re.IGNORECASE | re.UNICODE):
|
||||
logger.info("Removed from results: " + title + " (pre substring result).")
|
||||
return False
|
||||
#if artistterm != 'Various Artists':
|
||||
#
|
||||
# if not re.search('^' + re.escape(artistterm), title, re.IGNORECASE):
|
||||
# #logger.info("Removed from results: " + title + " (artist not at string start).")
|
||||
# #return False
|
||||
# elif re.search(re.escape(artistterm) + '\w', title, re.IGNORECASE | re.UNICODE):
|
||||
# logger.info("Removed from results: " + title + " (post substring result).")
|
||||
# return False
|
||||
# elif re.search('\w' + re.escape(artistterm), title, re.IGNORECASE | re.UNICODE):
|
||||
# logger.info("Removed from results: " + title + " (pre substring result).")
|
||||
# return False
|
||||
|
||||
#another attempt to weed out substrings. We don't want "Vol III" when we were looking for "Vol II"
|
||||
tokens = re.split('\W', term, re.IGNORECASE | re.UNICODE)
|
||||
|
||||
Reference in New Issue
Block a user