1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

- Removed annoying alert message when failed to retrieve newsnab capabilities (categories)

- Added backend debug logging
This commit is contained in:
KontiSR 2014-09-10 16:26:16 +02:00
parent 88479e7e1b
commit 3366108255
2 changed files with 12 additions and 2 deletions

View File

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

View File

@ -118,11 +118,19 @@ class NewznabProvider(generic.NZBProvider):
if self.needs_auth and self.key: if self.needs_auth and self.key:
params['apikey'] = 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) xml_categories = helpers.parse_xml(categories)
if not 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)) return (False, return_categories, "Error parsing xml for [%s]" % (self.name))
try: try:
@ -131,6 +139,8 @@ class NewznabProvider(generic.NZBProvider):
for subcat in category.findall('subcat'): for subcat in category.findall('subcat'):
return_categories.append(subcat.attrib) return_categories.append(subcat.attrib)
except: 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 (False, return_categories, "Error parsing result for [%s]" % (self.name))
return (True, return_categories, "") return (True, return_categories, "")