Fixed DATETIME typo, improved searching

This commit is contained in:
Remy
2011-07-20 03:05:09 -07:00
parent 8806ae2def
commit 1cf771c15d
4 changed files with 10 additions and 10 deletions

View File

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

View File

@@ -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:

View File

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

View File

@@ -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