From 5939dc2154d8477046b976803d94d2c2bdae2c87 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 5 Jul 2018 14:42:40 +0100 Subject: [PATCH] Fix Scenetime torrent provider. Change disable search torrents on first installation. Change some UI text. --- CHANGES.md | 8 ++++- .../default/config_postProcessing.tmpl | 2 +- .../interfaces/default/config_providers.tmpl | 5 +-- .../interfaces/default/config_search.tmpl | 3 +- sickbeard/__init__.py | 2 +- sickbeard/providers/scenetime.py | 35 ++++++++----------- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 368c0a3e..3a62d00a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,10 @@ -### 0.16.17 (2018-07-01 01:00:00 UTC) +### 0.16.18 (2018-07-05 14:45:00 UTC) + +* Fix Scenetime torrent provider +* Change disable search torrents on first installation + + +### 0.16.17 (2018-07-01 01:00:00 UTC) * Update UnRar for Windows 5.50 to 5.60 * Fix API save show paused state and API exception raised when no indexer results diff --git a/gui/slick/interfaces/default/config_postProcessing.tmpl b/gui/slick/interfaces/default/config_postProcessing.tmpl index 332dc0ab..4b4407c0 100644 --- a/gui/slick/interfaces/default/config_postProcessing.tmpl +++ b/gui/slick/interfaces/default/config_postProcessing.tmpl @@ -51,7 +51,7 @@
diff --git a/gui/slick/interfaces/default/config_search.tmpl b/gui/slick/interfaces/default/config_search.tmpl index c01c8c3a..7bf53d83 100755 --- a/gui/slick/interfaces/default/config_search.tmpl +++ b/gui/slick/interfaces/default/config_search.tmpl @@ -450,6 +450,7 @@ +
@@ -572,7 +573,7 @@
Click below to test

-
+
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 8a083b11..ace37d16 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -849,7 +849,7 @@ def initialize(console_logging=True): NAMING_STRIP_YEAR = bool(check_setting_int(CFG, 'General', 'naming_strip_year', 0)) USE_NZBS = bool(check_setting_int(CFG, 'General', 'use_nzbs', 0)) - USE_TORRENTS = bool(check_setting_int(CFG, 'General', 'use_torrents', 1)) + USE_TORRENTS = bool(check_setting_int(CFG, 'General', 'use_torrents', 0)) NZB_METHOD = check_setting_str(CFG, 'General', 'nzb_method', 'blackhole') if NZB_METHOD not in ('blackhole', 'sabnzbd', 'nzbget'): diff --git a/sickbeard/providers/scenetime.py b/sickbeard/providers/scenetime.py index ccf6e431..4071c5a4 100644 --- a/sickbeard/providers/scenetime.py +++ b/sickbeard/providers/scenetime.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with SickGear. If not, see . -import ast import re import traceback @@ -33,11 +32,13 @@ class SceneTimeProvider(generic.TorrentProvider): self.url_home = ['https://%s.scenetime.com/' % u for u in 'www', 'uk'] - self.url_vars = {'login': 'support.php', 'browse': 'browse_API.php', 'get': 'download.php/%s.torrent'} + self.url_vars = {'login': 'support.php', 'search': 'browse.php?cata=yes&%s&search=%s%s', + 'get': 'download.php/%s.torrent'} self.url_tmpl = {'config_provider_home_uri': '%(home)s', 'login': '%(home)s%(vars)s', - 'browse': '%(home)s%(vars)s', 'get': '%(home)s%(vars)s'} + 'search': '%(home)s%(vars)s', 'get': '%(home)s%(vars)s'} - self.categories = {'shows': [2, 43, 9, 63, 77, 79, 83]} + self.categories = {'Season': [43], 'Episode': [2, 9, 63, 77, 79, 100, 83, 19], 'anime': [18]} + self.categories['Cache'] = self.categories['Season'] + self.categories['Episode'] self.digest, self.freeleech, self.minseed, self.minleech = 4 * [None] @@ -61,25 +62,18 @@ class SceneTimeProvider(generic.TorrentProvider): items = {'Cache': [], 'Season': [], 'Episode': [], 'Propers': []} - rc = dict((k, re.compile('(?i)' + v)) for (k, v) in { - 'info': 'detail', 'get': '.*id=(\d+).*', 'fl': '\[freeleech\]', - 'cats': 'cat=(?:%s)' % self._categories_string(template='', delimiter='|')}.items()) for mode in search_params.keys(): + rc = dict((k, re.compile('(?i)' + v)) for (k, v) in { + 'info': 'detail', 'get': '.*id=(\d+).*', 'fl': '\[freeleech\]', + 'cats': 'cat=(?:%s)' % self._categories_string(mode=mode, template='', delimiter='|')}.items()) + for search_string in search_params[mode]: search_string = isinstance(search_string, unicode) and unidecode(search_string) or search_string - post_data = {'sec': 'jax', 'cata': 'yes'} - post_data.update(ast.literal_eval( - '{%s}' % self._categories_string(template='"c%s": "1"', delimiter=','))) - if 'Cache' != mode: - search_string = '+'.join(search_string.split()) - post_data['search'] = search_string - - if self.freeleech: - post_data.update({'freeleech': 'on'}) - - self.session.headers.update({'Referer': self.url + 'browse.php', 'X-Requested-With': 'XMLHttpRequest'}) - html = self.get_url(self.urls['browse'], post_data=post_data) + search_url = self.urls['search'] % (self._categories_string(), + '+'.join(search_string.replace('.', ' ').split()), + ('', '&freeleech=on')[self.freeleech]) + html = self.get_url(search_url) if self.should_skip(): return results @@ -124,8 +118,7 @@ class SceneTimeProvider(generic.TorrentProvider): except (StandardError, Exception): logger.log(u'Failed to parse. Traceback: %s' % traceback.format_exc(), logger.ERROR) - self._log_search(mode, len(items[mode]) - cnt, - ('search string: ' + search_string, self.name)['Cache' == mode]) + self._log_search(mode, len(items[mode]) - cnt, search_url) results = self._sort_seeding(mode, results + items[mode])