From cd2fa841dc8160b2eb56917b486708d74d53fd47 Mon Sep 17 00:00:00 2001 From: Remy Date: Wed, 20 Jul 2011 21:57:30 -0700 Subject: [PATCH] Bug fixes: ascii errors? NZBs.org categories --- headphones/importer.py | 4 +++- headphones/searcher.py | 8 ++++---- headphones/webserve.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/headphones/importer.py b/headphones/importer.py index ff9511ae..a26f445c 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -1,5 +1,4 @@ from lib.pyItunes import * -from lib.configobj import ConfigObj import time import os from lib.beets.mediafile import MediaFile @@ -14,6 +13,9 @@ def scanMusic(dir=None): if not dir: dir = headphones.MUSIC_DIR + if type(dir) != unicode: + dir = unicode(dir) + results = [] for r,d,f in os.walk(dir): diff --git a/headphones/searcher.py b/headphones/searcher.py index 325c428f..1e89acee 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -127,11 +127,11 @@ def searchNZB(albumid=None, new=False): if headphones.NZBSORG: if headphones.PREFERRED_QUALITY == 3: - categories = "3010" + categories = "5" maxsize = 10000000000 term = altterm elif headphones.PREFERRED_QUALITY: - categories = "5,3010" + categories = "5" maxsize = 2000000000 else: categories = "5" @@ -191,8 +191,8 @@ def searchNZB(albumid=None, new=False): try: albumlength = sum([pair[0] for pair in tracks]) - - targetsize = albumlength/1000 * headphones.PREFERRED_BITRATE * 128 + lgger.debug('Album length = %s' % albumlength) + targetsize = albumlength/1000 * int(headphones.PREFERRED_BITRATE) * 128 logger.info('Target size: %s' % helpers.bytes_to_mb(targetsize)) newlist = [] diff --git a/headphones/webserve.py b/headphones/webserve.py index 55b1ef32..10a4feee 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -292,7 +292,7 @@ class WebInterface(object): myDB.upsert("albums", newValueDict, controlValueDict) import searcher - threading.Thread(target=searcher.searchNZB, args=[AlbumID, new]).start() + searcher.searchNZB(AlbumID, new) raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)