Fixed bug preventing new downloads, albumpath fix

This commit is contained in:
Remy
2011-08-13 23:40:29 -07:00
parent 3bbedc65a7
commit 39225b48d6
2 changed files with 24 additions and 23 deletions
+5
View File
@@ -111,6 +111,11 @@ def verify(albumid, albumpath):
release = myDB.action('SELECT * from albums WHERE AlbumID=?', [albumid]).fetchone()
tracks = myDB.select('SELECT * from tracks WHERE AlbumID=?', [albumid])
try:
albumpath = str(albumpath)
except UnicodeEncodeError:
albumpath = unicode(albumpath).encode('unicode_escape')
downloaded_track_list = []
for r,d,f in os.walk(albumpath):
+19 -23
View File
@@ -382,33 +382,29 @@ def searchNZB(albumid=None, new=False):
if new:
# Checks to see if it's already downloaded
i = 0
while i < len(nzblist):
alreadydownloaded = myDB.select('SELECT * from snatched WHERE URL=?', [nzblist[i][2]])
if len(alreadydownloaded) >= 1:
logger.info('%s has already been downloaded. Skipping.' % nzblist[i][0])
i += 1
else:
bestqual = nzblist[i]
break
try:
x = bestqual[0]
except UnboundLocalError:
logger.info('No more matches for %s' % term)
return
else:
bestqual = nzblist[0]
logger.info(u'Found best result: <a href="%s">%s</a> - %s' % (bestqual[2], bestqual[0], helpers.bytes_to_mb(bestqual[1])))
while True:
if len(nzblist):
alreadydownloaded = myDB.select('SELECT * from snatched WHERE URL=?', [nzblist[0][2]])
if len(alreadydownloaded):
logger.info('%s has already been downloaded. Skipping.' % nzblist[0][0])
nzblist.pop(0)
else:
break
else:
logger.info('No more results found for %s' % term)
return
logger.info(u"Pre-processing result")
(data, bestqual) = preprocess(nzblist)
if data and bestqual:
logger.info(u'Found best result: <a href="%s">%s</a> - %s' % (bestqual[2], bestqual[0], helpers.bytes_to_mb(bestqual[1])))
nzb_folder_name = '%s - %s [%s]' % (helpers.latinToAscii(albums[0]).encode('UTF-8').replace('/', '_'), helpers.latinToAscii(albums[1]).encode('UTF-8').replace('/', '_'), year)
if headphones.SAB_HOST and not headphones.BLACKHOLE: