mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-30 16:33:37 +00:00
Merge pull request #953 from JackDandy/feature/ChangeNewznabApiKeyCheck
Change only use newznab Api key if needed.
This commit is contained in:
commit
79098a3b04
2 changed files with 10 additions and 8 deletions
|
@ -61,6 +61,7 @@
|
||||||
* Change improve search for PROPERS
|
* Change improve search for PROPERS
|
||||||
* Change catch show update task errors
|
* Change catch show update task errors
|
||||||
* Change simplify and update FreeBSD init script
|
* Change simplify and update FreeBSD init script
|
||||||
|
* Change only use newznab Api key if needed
|
||||||
|
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
|
@ -178,13 +178,14 @@ class NewznabProvider(generic.NZBProvider):
|
||||||
data = self.get_url('%s/api?t=caps' % self.url)
|
data = self.get_url('%s/api?t=caps' % self.url)
|
||||||
if data:
|
if data:
|
||||||
xml_caps = helpers.parse_xml(data)
|
xml_caps = helpers.parse_xml(data)
|
||||||
if (xml_caps is None or not hasattr(xml_caps, 'tag') or xml_caps.tag == 'error' or xml_caps.tag != 'caps') and \
|
if xml_caps is None or not hasattr(xml_caps, 'tag') or xml_caps.tag == 'error' or xml_caps.tag != 'caps':
|
||||||
self.maybe_apikey():
|
api_key = self.maybe_apikey()
|
||||||
data = self.get_url('%s/api?t=caps&apikey=%s' % (self.url, self.maybe_apikey()))
|
if isinstance(api_key, basestring) and api_key not in ('0', ''):
|
||||||
if data:
|
data = self.get_url('%s/api?t=caps&apikey=%s' % (self.url, api_key))
|
||||||
xml_caps = helpers.parse_xml(data)
|
if data:
|
||||||
if xml_caps and hasattr(xml_caps, 'tag') and xml_caps.tag == 'caps':
|
xml_caps = helpers.parse_xml(data)
|
||||||
self._caps_need_apikey = {'need': True, 'date': datetime.date.today()}
|
if xml_caps and hasattr(xml_caps, 'tag') and xml_caps.tag == 'caps':
|
||||||
|
self._caps_need_apikey = {'need': True, 'date': datetime.date.today()}
|
||||||
return xml_caps
|
return xml_caps
|
||||||
|
|
||||||
def get_caps(self):
|
def get_caps(self):
|
||||||
|
@ -579,7 +580,7 @@ class NewznabProvider(generic.NZBProvider):
|
||||||
if v in self.caps]),
|
if v in self.caps]),
|
||||||
'offset': 0}
|
'offset': 0}
|
||||||
|
|
||||||
if isinstance(api_key, basestring):
|
if isinstance(api_key, basestring) and api_key not in ('0', ''):
|
||||||
base_params['apikey'] = api_key
|
base_params['apikey'] = api_key
|
||||||
|
|
||||||
results, n_spaces = [], {}
|
results, n_spaces = [], {}
|
||||||
|
|
Loading…
Reference in a new issue