From 87877609220cbe841753603f4adb2d278dec798d Mon Sep 17 00:00:00 2001 From: JackDandy Date: Mon, 14 Sep 2015 16:33:51 +0100 Subject: [PATCH] Add PreToMe torrent provider. --- CHANGES.md | 1 + gui/slick/images/providers/pretome.png | Bin 0 -> 860 bytes sickbeard/__init__.py | 2 +- sickbeard/providers/__init__.py | 1 + sickbeard/providers/pretome.py | 98 +++++++++++++++++++++++++ sickbeard/providers/scenetime.py | 2 - 6 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 gui/slick/images/providers/pretome.png create mode 100644 sickbeard/providers/pretome.py diff --git a/CHANGES.md b/CHANGES.md index c037d267..a6338c24 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -31,6 +31,7 @@ * Change displayShow page episode colours when a minimum quality is met with "End upgrade on first match" * Add seed time per provider for torrent clients that support seed time per torrent, i.e. currently only uTorrent * Remove seed time display for Transmission in config/Torrent Search page because the torrent client doesn't support it +* Add PreToMe torrent provider * Add SceneTime torrent provider * Change TtN provider to parse new layout * Improve recognition of SD quality diff --git a/gui/slick/images/providers/pretome.png b/gui/slick/images/providers/pretome.png new file mode 100644 index 0000000000000000000000000000000000000000..efcefc517fd01003dc6a3dde2e7e57ad77d045b0 GIT binary patch literal 860 zcmV-i1Ec(jP)G?r8Re!x5k$ zbw1x7pAo&%6rtMWUbi46M!J2v*jwWB(fZm}-_uZ^g$5j0qTg?QdF68QrX$+Ao> z?cLPV`$S{@fJ6aFqLSY>JOBXJP@TT?k9kZvoo=9`zn`Sg8F}X>n|&d5-RTYEowx6k zF*c_f0N9@;hW1($Xlp?>eH-(Hi92`gp^AzvVN6j~a#WU2omiU~#p}xqHgQlcjh|se zQdJFNq9e6}Ub}{Iv!w%sdK)^b7U3PV3yUQiBJ0a;k@OF9b{wjKL>6uLx zVXyDow;yRQ&cf5jpmHF|4j5B`@`*|0BZzBW;GvJOZY^3kGn$16qd{Bl>mPu=xgJ$^ zAH;OPKL*&A2{5J*JgtNeBA_xLCW*g`kF+{`dFnoa_t$!2Z1lusfm$2}=o4 zML=vGz|(-CPQuUt@W}^^6Ofr>sxA6w{2>6ag};<{5fMG>AD}u%GEu`^qN|MPMI6!d zIrLy1s5wiZd-. + +import datetime + +from . import generic +from sickbeard import tvcache +from sickbeard.rssfeeds import RSSFeeds +from lib.unidecode import unidecode + + +class PreToMeProvider(generic.TorrentProvider): + + def __init__(self): + generic.TorrentProvider.__init__(self, 'PreToMe') + + self.url_base = 'https://pretome.info/' + + self.urls = {'config_provider_home_uri': self.url_base, + 'cache': self.url_base + 'rss.php?cat[]=7&sort=0&type=d&key=%s', + 'search': '&st=1&tf=all&search=%s'} + + self.url = self.urls['config_provider_home_uri'] + + self.passkey = None + self.cache = PreToMeCache(self) + + def _do_login(self): + + return self._check_auth() + + def _do_search(self, search_params, search_mode='eponly', epcount=0, age=0): + + self._do_login() + results = [] + + items = {'Season': [], 'Episode': [], 'Cache': []} + + url = self.urls['cache'] % self.passkey + for mode in search_params.keys(): + for search_string in search_params[mode]: + if isinstance(search_string, unicode): + search_string = unidecode(search_string) + + search_url = (url + self.urls['search'] % search_string, url)['Cache' == mode] + data = RSSFeeds(self).get_feed(search_url) + + cnt = len(items[mode]) + if data and 'entries' in data: + for entry in data['entries']: + try: + if entry['title'] and 'download' in entry['link']: + items[mode].append((entry['title'], entry['link'])) + except KeyError: + continue + + self._log_result(mode, len(items[mode]) - cnt, search_url) + + results += items[mode] + + return results + + def find_propers(self, search_date=datetime.datetime.today()): + + return self._find_propers(search_date) + + def _get_episode_search_strings(self, ep_obj, add_string='', **kwargs): + + return generic.TorrentProvider._get_episode_search_strings(self, ep_obj, add_string, use_or=False) + + +class PreToMeCache(tvcache.TVCache): + + def __init__(self, this_provider): + tvcache.TVCache.__init__(self, this_provider) + + self.minTime = 6 # cache update frequency + + def _getRSSData(self): + + return self.provider.get_cache_data() + + +provider = PreToMeProvider() diff --git a/sickbeard/providers/scenetime.py b/sickbeard/providers/scenetime.py index 78cb98bf..8bfc3fd5 100644 --- a/sickbeard/providers/scenetime.py +++ b/sickbeard/providers/scenetime.py @@ -30,8 +30,6 @@ class SceneTimeProvider(generic.TorrentProvider): def __init__(self): generic.TorrentProvider.__init__(self, 'SceneTime') -# https://www.scenetime.com/download.php/860856/Whose.Line.is.it.Anyway.US.S11E13.HDTV.x264-BAJSKORV.torrent -# Whose Line is it Anyway US S11E13 HDTV x264-BAJSKORV self.url_base = 'https://www.scenetime.com/' self.urls = {'config_provider_home_uri': self.url_base, 'login': self.url_base + 'takelogin.php',