Merge branch 'nightly' into dev

This commit is contained in:
Clinton Hall 2018-06-22 16:24:13 +12:00 committed by GitHub
commit 9ac74615af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1185 additions and 29 deletions

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://"
@ -67,6 +69,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)
except requests.ConnectionError: