Fix login to SickGear during auto-frok detection. Fixes #1346
This commit is contained in:
clinton-hall 2018-05-23 22:24:50 +12:00
commit 0259b83afa
2 changed files with 10 additions and 5 deletions

View file

@ -61,10 +61,10 @@ FORKS = {}
FORK_DEFAULT = "default"
FORK_FAILED = "failed"
FORK_FAILED_TORRENT = "failed-torrent"
FORK_SICKRAGETV = "sickragetv"
FORK_SICKRAGE = "sickrage"
FORK_MEDUSA = "medusa"
FORK_SICKGEAR = "sickgear"
FORK_SICKRAGETV = "SickRageTV"
FORK_SICKRAGE = "SickRage"
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}

View file

@ -21,8 +21,10 @@ 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'}
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(cfg.get("fork", "auto"))]
fork = core.FORKS.items()[core.FORKS.keys().index(f1)]
except:
fork = "auto"
protocol = "https://" if ssl else "http://"
@ -61,6 +63,9 @@ def autoFork(section, inputCategory):
login = "{protocol}{host}:{port}{root}/login".format(
protocol=protocol, host=host, port=port, root=web_root)
login_params = {'username': username, 'password': password}
r = s.get(login, verify=False, timeout=(30,60))
if r.status_code == 401 and r.cookies.get('_xsrf'):
login_params['_xsrf'] = r.cookies.get('_xsrf')
s.post(login, data=login_params, stream=True, verify=False)
r = s.get(url, auth=(username, password), verify=False)
else: