From 1d7142c774a06ba5a6a9636d1fba833c4abf05ce Mon Sep 17 00:00:00 2001 From: clashlab Date: Wed, 23 Jan 2013 15:06:32 +0100 Subject: [PATCH] Fix NZBsRus results parsing NZBsRus search returns a Python dictionnary. This fix allows to take into account NZBsRus results. Calling eval is not a really good idea and should be replaced --- headphones/searcher.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/headphones/searcher.py b/headphones/searcher.py index 9d0e4d01..0027db29 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -348,18 +348,18 @@ def searchNZB(albumid=None, new=False, losslessOnly=False): if data: - d = feedparser.parse(data) + d = eval(data.replace('null','None')) - if not len(d.entries): + if d['matches'] <= 0: logger.info(u"No results found from NZBsRus for %s" % term) pass else: - for item in d.entries: + for item in d['results']: try: - url = item.link - title = item.title - size = int(item.links[1]['length']) + url = "http://www.nzbsrus.com/nzbdownload_rss.php/" + item['id'] + "/" + headphones.NZBSRUS_UID + "/" + item['key'] + title = item['name'] + size = int(item['size']) resultlist.append((title, size, url, provider)) logger.info('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))