change sickrage names and modify api process to work with multiple forks. Fixes #1383 & #1152

This commit is contained in:
clinton-hall 2018-10-13 17:46:35 +13:00
commit fb24a987ca
2 changed files with 16 additions and 10 deletions

View file

@ -62,17 +62,17 @@ FORKS = {}
FORK_DEFAULT = "default"
FORK_FAILED = "failed"
FORK_FAILED_TORRENT = "failed-torrent"
FORK_SICKRAGETV = "SickRageTV"
FORK_SICKRAGE = "SickRage"
FORK_SICKRAGE_API = "SiCKRAGE-api"
FORK_SICKCHILL = "SickChill"
FORK_SICKBEARD_API = "SickBeard-api"
FORK_MEDUSA = "Medusa"
FORK_SICKGEAR = "SickGear"
FORKS[FORK_DEFAULT] = {"dir": None}
FORKS[FORK_FAILED] = {"dirName": None, "failed": None}
FORKS[FORK_FAILED_TORRENT] = {"dir": None, "failed": None, "process_method": None}
FORKS[FORK_SICKRAGETV] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
FORKS[FORK_SICKRAGE] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "force_next": None}
FORKS[FORK_SICKRAGE_API] = {"path": None, "failed": None, "process_method": None, "force_replace": None, "return_data": None, "type": None, "delete": None, "force_next": None}
FORKS[FORK_SICKRAGE] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
FORKS[FORK_SICKCHILL] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "force_next": None}
FORKS[FORK_SICKBEARD_API] = {"path": None, "failed": None, "process_method": None, "force_replace": None, "return_data": None, "type": None, "delete": None, "force_next": None}
FORKS[FORK_MEDUSA] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "ignore_subs":None}
FORKS[FORK_SICKGEAR] = {"dir": None, "failed": None, "process_method": None, "force": None}
ALL_FORKS = {k:None for k in set(list(itertools.chain.from_iterable([FORKS[x].keys() for x in FORKS.keys()])))}

View file

@ -21,7 +21,7 @@ def autoFork(section, inputCategory):
apikey = cfg.get("apikey")
ssl = int(cfg.get("ssl", 0))
web_root = cfg.get("web_root", "")
replace = {'sickrage':'SickRage', 'sickragetv':'SickRageTV', 'sickgear':'SickGear', 'medusa':'Medusa', 'sickrage-api':'SiCKRAGE-api'}
replace = {'sickrage':'SickRage', 'sickchill':'SickChill', 'sickgear':'SickGear', 'medusa':'Medusa', 'sickbeard-api':'SickBeard-api'}
f1 = replace[cfg.get("fork", "auto")] if cfg.get("fork", "auto") in replace else cfg.get("fork", "auto")
try:
fork = core.FORKS.items()[core.FORKS.keys().index(f1)]
@ -79,11 +79,17 @@ def autoFork(section, inputCategory):
(section=section, category=inputCategory))
r = []
if r and r.ok:
for param in params:
if apikey:
if param not in r.json()['data']['optionalParameters'].keys():
optionalParameters = []
try:
optionalParameters = r.json()['data']['optionalParameters'].keys()
except:
optionalParameters = r.json()['data']['data']['optionalParameters'].keys()
for param in params:
if param not in optionalParameters:
rem_params.append(param)
else:
for param in params:
if 'name="{param}"'.format(param=param) not in r.text:
rem_params.append(param)
for param in rem_params: