From 52218fcd6bda1a8a02da77ceb4c9542e2d70dc87 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Tue, 17 Jul 2018 14:30:39 +0100 Subject: [PATCH] Change TorrentDay and fix for Emby updater when no folders are returned from API. --- CHANGES.md | 8 +++++++- sickbeard/providers/torrentday.py | 15 ++++++++------- sickbeard/webserve.py | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2e303f87..b8577215 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,10 @@ -### 0.16.19 (2018-07-05 18:10:00 UTC) +### 0.16.20 (2018-07-17 14:30:00 UTC) + +* Change TorrentDay +* Fix for Emby updater when no folders are returned from API + + +### 0.16.19 (2018-07-05 18:10:00 UTC) * Fix Uuid1 Python Bug, add fallback to uuid4 when uuid1 fails with ValueError https://bugs.python.org/issue32502 diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index defa8e9a..71166a2b 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -44,7 +44,7 @@ class TorrentDayProvider(generic.TorrentProvider): 'Vmbq', 'WL10', 'ZyZ', 'rFW', '5yc', '12bj', 'q=0']] ]]] - self.url_vars = {'login': 'rss.php', 'search': 'browse.php?cata=yes&%s%s&search=%s%s'} + self.url_vars = {'login': 'rss.php', 'search': 't?%s%s&qf=&q=%s'} self.url_tmpl = {'config_provider_home_uri': '%(home)s', 'login': '%(home)s%(vars)s', 'search': '%(home)s%(vars)s'} @@ -76,14 +76,13 @@ class TorrentDayProvider(generic.TorrentProvider): items = {'Cache': [], 'Season': [], 'Episode': [], 'Propers': []} - rc = dict((k, re.compile('(?i)' + v)) for (k, v) in {'info': 'detail', 'get': 'download'}.items()) + rc = dict((k, re.compile('(?i)' + v)) for (k, v) in {'get': 'download'}.items()) for mode in search_params.keys(): for search_string in search_params[mode]: search_string = '+'.join(search_string.split()) search_url = self.urls['search'] % ( - self._categories_string(mode), ('&free=on', '')[not self.freeleech], - search_string, ('&sort=7&type=desc', '')['Cache' == mode]) + self._categories_string(mode, '%s=on'), ('&free=on', '')[not self.freeleech], search_string) html = self.get_url(search_url) if self.should_skip(): @@ -114,9 +113,11 @@ class TorrentDayProvider(generic.TorrentProvider): if self._peers_fail(mode, seeders, leechers): continue - title = tr.find('a', href=rc['info']).get_text().strip() - download_url = self._link(tr.find('a', href=rc['get'])['href']) - except (AttributeError, TypeError, ValueError): + dl = tr.find('a', href=rc['get'])['href'] + title = tr.find('a', href=re.compile( + '/t/%s' % re.findall('download.*?/([^/]+)', dl)[0])).get_text().strip() + download_url = self._link(dl) + except (AttributeError, TypeError, ValueError, IndexError): continue if title and download_url: diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 948a5b6f..6a6d7548 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -5369,7 +5369,7 @@ class History(MainHandler): folder = sickbeard.helpers.getURL('%s/Items/%s' % (user_url, folder_id), headers=headers, params=dict(format='json'), timeout=10, json=True) - if 'tvshows' != folder.get('CollectionType', ''): + if not folder or 'tvshows' != folder.get('CollectionType', ''): continue items = sickbeard.helpers.getURL('%s/Items' % user_url, headers=headers,