From 33661082553cd344d9da2e5aa0d4973fdca81c87 Mon Sep 17 00:00:00 2001 From: KontiSR Date: Wed, 10 Sep 2014 16:26:16 +0200 Subject: [PATCH] - Removed annoying alert message when failed to retrieve newsnab capabilities (categories) - Added backend debug logging --- gui/slick/js/configProviders.js | 2 +- sickbeard/providers/newznab.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gui/slick/js/configProviders.js b/gui/slick/js/configProviders.js index 56fd8c93..ae20e906 100644 --- a/gui/slick/js/configProviders.js +++ b/gui/slick/js/configProviders.js @@ -32,7 +32,6 @@ $(document).ready(function(){ $.getJSON(sbRoot + '/config/providers/getNewznabCategories', params, function(data){ if (data.error != "") { - alert(data.error); return false; } @@ -661,4 +660,5 @@ $(document).ready(function(){ $("#provider_order_list").disableSelection(); +}); }); \ No newline at end of file diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index ba7bada4..587b364e 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -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, "")