From dd35c7b9f6ee8472967d2d8e7e0d60f10fe503cb Mon Sep 17 00:00:00 2001 From: JackDandy Date: Sun, 20 Mar 2016 20:07:10 +0000 Subject: [PATCH] Change add optional login URL. --- sickbeard/providers/generic.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index aaeabec0..57712ddf 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -812,7 +812,16 @@ class TorrentProvider(object, GenericProvider): response = helpers.getURL(url, session=self.session) try: action = re.findall('[<]form[\w\W]+?action="([^"]+)', response)[0] - url = self.urls['config_provider_home_uri'] + action.lstrip('/') + url = (self.urls.get('login_base') or + self.urls['config_provider_home_uri']) + action.lstrip('/') + + tags = re.findall(r'(?is)()', response) + nv = [(tup[0]) for tup in [re.findall(r'(?is)name="([^"]+)"(?:.*?value="([^"]+)")?', x) + for x in tags]] + for name, value in nv: + if name not in ('username', 'password'): + post_params = isinstance(post_params, type({})) and post_params or {} + post_params.setdefault(name, value) except KeyError: return super(TorrentProvider, self)._authorised() else: