From 4fb5d6ea909772a6ada771817f7008ea420fafb5 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Tue, 21 Jun 2016 02:06:56 +0100 Subject: [PATCH] Change logged in and a fail-over signature. --- sickbeard/providers/generic.py | 1 - sickbeard/providers/iptorrents.py | 6 +++++- sickbeard/providers/kat.py | 2 +- sickbeard/providers/torrentday.py | 7 ++++++- sickbeard/providers/torrenting.py | 6 +++++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 61703ab7..b81d616b 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -922,7 +922,6 @@ class TorrentProvider(object, GenericProvider): if self.password not in post_params.values(): post_params['password'] = self.password - response = helpers.getURL(url, post_data=post_params, session=self.session, timeout=timeout) if response: if logged_in(response): diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index 8abc5576..b6417c45 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -44,10 +44,14 @@ class IPTorrentsProvider(generic.TorrentProvider): def _authorised(self, **kwargs): return super(IPTorrentsProvider, self)._authorised( - logged_in=(lambda x=None: (None is x or 'RSS Link' in x) and self.has_all_cookies() and + logged_in=(lambda x='': ('RSS Link' in x) and self.has_all_cookies() and self.session.cookies['uid'] in self.digest and self.session.cookies['pass'] in self.digest), failed_msg=(lambda x=None: u'Invalid cookie details for %s. Check settings')) + @staticmethod + def _has_signature(data=None): + return generic.TorrentProvider._has_signature(data) or (data and re.search(r'(?i)KAT)', data[15:1024:]) or 'kastatic' in data) + return data and (re.search(r'(?sim)(KAT)', data[15:1024:]) or 'kastat' in data) def _find_season_quality(self, title, torrent_link, ep_number): """ Return the modified title of a Season Torrent with the quality found inspecting torrent file list """ diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 9ded8c53..16d095be 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -45,10 +45,15 @@ class TorrentDayProvider(generic.TorrentProvider): def _authorised(self, **kwargs): return super(TorrentDayProvider, self)._authorised( - logged_in=(lambda x=None: (None is x or 'RSS URL' in x) and self.has_all_cookies() and + logged_in=(lambda x='': ('RSS URL' in x) and self.has_all_cookies() and self.session.cookies['uid'] in self.digest and self.session.cookies['pass'] in self.digest), failed_msg=(lambda x=None: u'Invalid cookie details for %s. Check settings')) + @staticmethod + def _has_signature(data=None): + return generic.TorrentProvider._has_signature(data) or \ + (data and re.search(r'(?i)<title[^<]+?(td|torrentday)', data)) + def _search_provider(self, search_params, **kwargs): results = [] diff --git a/sickbeard/providers/torrenting.py b/sickbeard/providers/torrenting.py index 7b1fb831..6379a4e0 100644 --- a/sickbeard/providers/torrenting.py +++ b/sickbeard/providers/torrenting.py @@ -43,10 +43,14 @@ class TorrentingProvider(generic.TorrentProvider): def _authorised(self, **kwargs): return super(TorrentingProvider, self)._authorised( - logged_in=(lambda x=None: (None is x or 'RSS link' in x) and self.has_all_cookies() and + logged_in=(lambda x='': ('RSS link' in x) and self.has_all_cookies() and self.session.cookies['uid'] in self.digest and self.session.cookies['pass'] in self.digest), failed_msg=(lambda x=None: u'Invalid cookie details for %s. Check settings')) + @staticmethod + def _has_signature(data=None): + return generic.TorrentProvider._has_signature(data) or (data and re.search(r'(?i)<title[^<]+?Torrenting', data)) + def _search_provider(self, search_params, **kwargs): results = []