mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -07:00
fix SG parsing. #1635
This commit is contained in:
parent
10d21bd801
commit
1efc8293f0
1 changed files with 6 additions and 6 deletions
|
@ -13,7 +13,7 @@ from six import iteritems
|
||||||
import core
|
import core
|
||||||
from core import logger
|
from core import logger
|
||||||
|
|
||||||
def api_check(r, excess_parameters, rem_parameters):
|
def api_check(r, params, rem_params):
|
||||||
try:
|
try:
|
||||||
json_data = r.json()
|
json_data = r.json()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -36,10 +36,10 @@ def api_check(r, excess_parameters, rem_parameters):
|
||||||
excess_parameters = set(params).difference(optional_parameters)
|
excess_parameters = set(params).difference(optional_parameters)
|
||||||
logger.debug('Removing excess parameters: {}'.format(sorted(excess_parameters)))
|
logger.debug('Removing excess parameters: {}'.format(sorted(excess_parameters)))
|
||||||
rem_params.extend(excess_parameters)
|
rem_params.extend(excess_parameters)
|
||||||
return excess_parameters, rem_parameters, True
|
return rem_params, True
|
||||||
except:
|
except:
|
||||||
logger.error('Failed to identify optionalParameters')
|
logger.error('Failed to identify optionalParameters')
|
||||||
return excess_parameters, rem_parameters, False
|
return rem_params, False
|
||||||
|
|
||||||
|
|
||||||
def auto_fork(section, input_category):
|
def auto_fork(section, input_category):
|
||||||
|
@ -126,9 +126,9 @@ def auto_fork(section, input_category):
|
||||||
r = []
|
r = []
|
||||||
if r and r.ok:
|
if r and r.ok:
|
||||||
if apikey:
|
if apikey:
|
||||||
excess_parameters, rem_parameters, found = api_check(r, excess_parameters, rem_parameters)
|
rem_params, found = api_check(r, params, rem_params)
|
||||||
if not found: # try different api set for SickGear.
|
if not found: # try different api set for SickGear.
|
||||||
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=postprocess&jsonp=foo&help=1'.format(
|
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=postprocess&help=1'.format(
|
||||||
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey,
|
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
@ -136,7 +136,7 @@ def auto_fork(section, input_category):
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format
|
logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format
|
||||||
(section=section, category=input_category))
|
(section=section, category=input_category))
|
||||||
excess_parameters, rem_parameters, found = api_check(r, excess_parameters, rem_parameters)
|
rem_params, found = api_check(r, params, rem_params)
|
||||||
else:
|
else:
|
||||||
# Find excess parameters
|
# Find excess parameters
|
||||||
rem_params.extend(
|
rem_params.extend(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue