mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 11:58:01 -05:00
Fix for SCC provider, resolves NoneType issues
This commit is contained in:
parent
0c06c3a82e
commit
468af14dfd
@ -166,30 +166,27 @@ class SCCProvider(generic.TorrentProvider):
|
||||
if not self._doLogin():
|
||||
return []
|
||||
|
||||
data = []
|
||||
searchURLS = []
|
||||
|
||||
for mode in search_params.keys():
|
||||
for search_string in search_params[mode]:
|
||||
|
||||
if isinstance(search_string, unicode):
|
||||
search_string = unidecode(search_string)
|
||||
|
||||
nonsceneSearchURL = None
|
||||
foreignSearchURL = None
|
||||
if mode == 'Season':
|
||||
searchURL = self.urls['archive'] % (search_string)
|
||||
data = [self.getURL(searchURL)]
|
||||
searchURLS += [self.urls['archive'] % (search_string)]
|
||||
else:
|
||||
searchURL = self.urls['search'] % (search_string, self.categories)
|
||||
nonsceneSearchURL = self.urls['nonscene'] % (search_string)
|
||||
foreignSearchURL = self.urls['foreign'] % (search_string)
|
||||
data = [self.getURL(searchURL),
|
||||
self.getURL(nonsceneSearchURL),
|
||||
self.getURL(foreignSearchURL)]
|
||||
logger.log(u"Search string: " + nonsceneSearchURL, logger.DEBUG)
|
||||
logger.log(u"Search string: " + foreignSearchURL, logger.DEBUG)
|
||||
searchURLS += [self.urls['search'] % (search_string, self.categories)]
|
||||
searchURLS += [self.urls['nonscene'] % (search_string)]
|
||||
searchURLS += [self.urls['foreign'] % (search_string)]
|
||||
|
||||
for searchURL in searchURLS:
|
||||
logger.log(u"Search string: " + searchURL, logger.DEBUG)
|
||||
data += [x for x in [self.getURL(searchURL)] if x]
|
||||
|
||||
if not data:
|
||||
if not len(data):
|
||||
continue
|
||||
|
||||
try:
|
||||
@ -238,23 +235,17 @@ class SCCProvider(generic.TorrentProvider):
|
||||
continue
|
||||
|
||||
item = title, download_url, id, seeders, leechers
|
||||
|
||||
if self._isSection('Non-Scene', dataItem):
|
||||
logger.log(u"Found result: " + title + "(" + nonsceneSearchURL + ")", logger.DEBUG)
|
||||
elif self._isSection('Foreign', dataItem):
|
||||
logger.log(u"Found result: " + title + "(" + foreignSearchURL + ")", logger.DEBUG)
|
||||
else:
|
||||
logger.log(u"Found result: " + title + "(" + searchURL + ")", logger.DEBUG)
|
||||
#logger.log(u"Found result: " + title + "(" + searchURL + ")", logger.DEBUG)
|
||||
|
||||
items[mode].append(item)
|
||||
|
||||
# for each search mode sort all the items by seeders
|
||||
items[mode].sort(key=lambda tup: tup[3], reverse=True)
|
||||
results += items[mode]
|
||||
|
||||
except Exception, e:
|
||||
logger.log(u"Failed parsing " + self.name + " Traceback: " + traceback.format_exc(), logger.ERROR)
|
||||
|
||||
#For each search mode sort all the items by seeders
|
||||
items[mode].sort(key=lambda tup: tup[3], reverse=True)
|
||||
|
||||
results += items[mode]
|
||||
continue
|
||||
|
||||
return results
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user