mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 20:29:27 +00:00
Fixed DATETIME typo, improved searching
This commit is contained in:
@@ -19,12 +19,7 @@ def scanMusic(dir=None):
|
||||
for r,d,f in os.walk(dir):
|
||||
for files in f:
|
||||
if any(files.endswith(x) for x in (".mp3", ".flac", ".aac", ".ogg", ".ape")):
|
||||
#logger.debug('File found: %s' % files)
|
||||
try:
|
||||
results.append(os.path.join(r.encode('UTF-8'), files.encode('UTF-8')))
|
||||
except UnicodeDecodeError, e:
|
||||
logger.error('Can not decode file %s. Error: %s' % (str(files), str(e)))
|
||||
continue
|
||||
results.append(os.path.join(r, files))
|
||||
|
||||
logger.info(u'%i music files found. Reading metadata....' % len(results))
|
||||
|
||||
|
||||
@@ -18,11 +18,16 @@ mb_lock = threading.Lock()
|
||||
def findArtist(name, limit=1):
|
||||
|
||||
with mb_lock:
|
||||
|
||||
|
||||
artistlist = []
|
||||
attempt = 0
|
||||
artistResults = None
|
||||
term = '"'+name+'"'
|
||||
|
||||
chars = set('!?')
|
||||
if any((c in chars) for c in name):
|
||||
term = '"'+name+'"'
|
||||
else:
|
||||
term = name
|
||||
|
||||
while attempt < 5:
|
||||
|
||||
|
||||
@@ -261,4 +261,4 @@ def searchNZB(albumid=None):
|
||||
break
|
||||
|
||||
myDB.action('UPDATE albums SET status = "Snatched" WHERE AlbumID=?', [albums[2]])
|
||||
myDB.action('INSERT INTO snatched VALUES( ?, ?, ?, ?, DATEIME("NOW", "localtime"), ?)', [albums[2], bestqual[0], bestqual[1], bestqual[2], "Snatched"])
|
||||
myDB.action('INSERT INTO snatched VALUES( ?, ?, ?, ?, DATETIME("NOW", "localtime"), ?)', [albums[2], bestqual[0], bestqual[1], bestqual[2], "Snatched"])
|
||||
@@ -198,7 +198,7 @@ class WebInterface(object):
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
else:
|
||||
artistResults = mb.findArtist(name, limit=10)
|
||||
if len(artistResults) == 0:
|
||||
if not artistResults:
|
||||
logger.info(u"No results found for " + name)
|
||||
page.append('''<div class="table"><p class="center">No results! <a class="blue" href="home">Go back</a></p></div>''')
|
||||
return page
|
||||
|
||||
Reference in New Issue
Block a user