1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-10 19:35:08 -05:00

Merge pull request #788 from KontiSR/dev-improvements-newznab-capabilities

Dev improvements newznab capabilities
This commit is contained in:
adam111316 2014-09-10 23:32:18 +08:00
commit bb261cfc79
2 changed files with 11 additions and 2 deletions

View File

@ -32,7 +32,6 @@ $(document).ready(function(){
$.getJSON(sbRoot + '/config/providers/getNewznabCategories', params,
function(data){
if (data.error != "") {
alert(data.error);
return false;
}

View File

@ -118,11 +118,19 @@ class NewznabProvider(generic.NZBProvider):
if self.needs_auth and self.key:
params['apikey'] = self.key
categories = self.getURL("%s/api" % (self.url), params=params)
try:
categories = self.getURL("%s/api" % (self.url), params=params, timeout=10)
except:
logger.log(u"Error getting html for [%s]" %
("%s/api?%s" % (self.url, '&'.join("%s=%s" % (x,y) for x,y in params.items())) ), logger.DEBUG)
return (False, return_categories, "Error getting html for [%s]" %
("%s/api?%s" % (self.url, '&'.join("%s=%s" % (x,y) for x,y in params.items()) )))
xml_categories = helpers.parse_xml(categories)
if not xml_categories:
logger.log(u"Error parsing xml for [%s]" % (self.name),
logger.DEBUG)
return (False, return_categories, "Error parsing xml for [%s]" % (self.name))
try:
@ -131,6 +139,8 @@ class NewznabProvider(generic.NZBProvider):
for subcat in category.findall('subcat'):
return_categories.append(subcat.attrib)
except:
logger.log(u"Error parsing result for [%s]" % (self.name),
logger.DEBUG)
return (False, return_categories, "Error parsing result for [%s]" % (self.name))
return (True, return_categories, "")