mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Merge pull request #788 from KontiSR/dev-improvements-newznab-capabilities
Dev improvements newznab capabilities
This commit is contained in:
commit
bb261cfc79
2 changed files with 11 additions and 2 deletions
|
@ -32,7 +32,6 @@ $(document).ready(function(){
|
|||
$.getJSON(sbRoot + '/config/providers/getNewznabCategories', params,
|
||||
function(data){
|
||||
if (data.error != "") {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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, "")
|
||||
|
|
Loading…
Reference in a new issue