From 9011d3e4493afba88ada7e78412d28ece52a8152 Mon Sep 17 00:00:00 2001 From: Remy Date: Sun, 17 Jul 2011 03:02:29 -0700 Subject: [PATCH] Some more bug fixes: tracks could only be on one release, newznab hanging --- headphones/importer.py | 4 ++-- headphones/searcher.py | 10 ++++------ headphones/webserve.py | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/headphones/importer.py b/headphones/importer.py index 1ea0a623..4bba8f25 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -171,12 +171,12 @@ def addArtisttoDB(artistid): for track in release['tracks']: - controlValueDict = {"TrackID": track['id']} + controlValueDict = {"TrackID": track['id'], + "AlbumID": rg['id']} newValueDict = {"ArtistID": artistid, "ArtistName": artist['artist_name'], "AlbumTitle": rg['title'], "AlbumASIN": release['asin'], - "AlbumID": rg['id'], "TrackTitle": track['title'], "TrackDuration": track['duration'], } diff --git a/headphones/searcher.py b/headphones/searcher.py index 3b32a6a2..c3299283 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -86,11 +86,9 @@ def searchNZB(albumid=None): searchURL = headphones.NEWZNAB_HOST + '/api?' + urllib.urlencode(params) logger.info(u"Parsing results from "+searchURL) - - try: - d = feedparser.parse(searchURL) - except Exception, e: - logger.error('Error parsing data from ' + headphones.NEWZNAB_HOST + ' : ' + str(e)) + + d = feedparser.parse(searchURL) + logger.debug('Parsing complete. Found %i results' % len(d.entries)) for item in d.entries: try: @@ -154,7 +152,7 @@ def searchNZB(albumid=None): logger.info(u"Found best result: %s (%s) - %s" % (bestqual[0], bestqual[2], helpers.bytes_to_mb(bestqual[1]))) downloadurl = bestqual[2] - + if headphones.SAB_HOST and not headphones.BLACKHOLE: linkparams = {} diff --git a/headphones/webserve.py b/headphones/webserve.py index 7afcca7a..026a4a2e 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -575,7 +575,10 @@ class WebInterface(object): logger.info(u"Headphones is shutting down...") threading.Timer(2, headphones.shutdown).start() page = [templates._shutdownheader % 10] - page.append('Shutting down Headphones...') + page.append(templates._logobar) + page.append(templates._nav) + page.append('
Shutting down Headphones...
') + page.append(templates._footer % headphones.CURRENT_VERSION) return page shutdown.exposed = True @@ -584,7 +587,10 @@ class WebInterface(object): logger.info(u"Headphones is restarting...") threading.Timer(2, headphones.shutdown, [True]).start() page = [templates._shutdownheader % 20] - page.append('Restarting Headphones...') + page.append(templates._logobar) + page.append(templates._nav) + page.append('
Restarting Headphones...
') + page.append(templates._footer % headphones.CURRENT_VERSION) return page restart.exposed = True @@ -593,7 +599,10 @@ class WebInterface(object): logger.info('Headphones is updating...') threading.Timer(2, headphones.shutdown, [True, True]).start() page = [templates._shutdownheader % 60] - page.append('Updating Headphones...') + page.append(templates._logobar) + page.append(templates._nav) + page.append('
Updating Headphones...
') + page.append(templates._footer % headphones.CURRENT_VERSION) return page update.exposed = True \ No newline at end of file