mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-08 12:28:05 -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():
|
if not self._doLogin():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
data = []
|
||||||
|
searchURLS = []
|
||||||
|
|
||||||
for mode in search_params.keys():
|
for mode in search_params.keys():
|
||||||
for search_string in search_params[mode]:
|
for search_string in search_params[mode]:
|
||||||
|
|
||||||
if isinstance(search_string, unicode):
|
if isinstance(search_string, unicode):
|
||||||
search_string = unidecode(search_string)
|
search_string = unidecode(search_string)
|
||||||
|
|
||||||
nonsceneSearchURL = None
|
|
||||||
foreignSearchURL = None
|
|
||||||
if mode == 'Season':
|
if mode == 'Season':
|
||||||
searchURL = self.urls['archive'] % (search_string)
|
searchURLS += [self.urls['archive'] % (search_string)]
|
||||||
data = [self.getURL(searchURL)]
|
|
||||||
else:
|
else:
|
||||||
searchURL = self.urls['search'] % (search_string, self.categories)
|
searchURLS += [self.urls['search'] % (search_string, self.categories)]
|
||||||
nonsceneSearchURL = self.urls['nonscene'] % (search_string)
|
searchURLS += [self.urls['nonscene'] % (search_string)]
|
||||||
foreignSearchURL = self.urls['foreign'] % (search_string)
|
searchURLS += [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)
|
|
||||||
|
|
||||||
|
for searchURL in searchURLS:
|
||||||
logger.log(u"Search string: " + searchURL, logger.DEBUG)
|
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
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -238,23 +235,17 @@ class SCCProvider(generic.TorrentProvider):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
item = title, download_url, id, seeders, leechers
|
item = title, download_url, id, seeders, leechers
|
||||||
|
#logger.log(u"Found result: " + title + "(" + searchURL + ")", logger.DEBUG)
|
||||||
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)
|
|
||||||
|
|
||||||
items[mode].append(item)
|
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:
|
except Exception, e:
|
||||||
logger.log(u"Failed parsing " + self.name + " Traceback: " + traceback.format_exc(), logger.ERROR)
|
logger.log(u"Failed parsing " + self.name + " Traceback: " + traceback.format_exc(), logger.ERROR)
|
||||||
|
continue
|
||||||
#For each search mode sort all the items by seeders
|
|
||||||
items[mode].sort(key=lambda tup: tup[3], reverse=True)
|
|
||||||
|
|
||||||
results += items[mode]
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user