From 36251ec71fbb83800f79ddba3b73b9a58490b997 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 17 May 2018 01:07:25 +0100 Subject: [PATCH] Add ImmortalSeed torrent provider. --- CHANGES.md | 1 + gui/slick/images/providers/immortalseed.png | Bin 0 -> 466 bytes .../interfaces/default/config_providers.tmpl | 12 +- sickbeard/providers/__init__.py | 3 +- sickbeard/providers/immortalseed.py | 113 ++++++++++++++++++ 5 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 gui/slick/images/providers/immortalseed.png create mode 100644 sickbeard/providers/immortalseed.py diff --git a/CHANGES.md b/CHANGES.md index 4af98b75..4447628a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * Update Tornado Web Server 5.0.1 (35a538f) to 5.0.1 (2b2a220a) * Add HDME torrent provider +* Add ImmortalSeed torrent provider * Add Xspeeds torrent provider diff --git a/gui/slick/images/providers/immortalseed.png b/gui/slick/images/providers/immortalseed.png new file mode 100644 index 0000000000000000000000000000000000000000..5c7ec08a37b97244a03dbece8ab49c09c8be1954 GIT binary patch literal 466 zcmV;@0WJQCP)MwjyJU zkLAatQmR8BfvmN9=>{Yi)@{qBLYT&(R_oGK%?C2a$SOjB^yP$x;reU-0ZFo&m0}Vl zm{A6q4l-{J0KN6Pf)d4x6$-6isj literal 0 HcmV?d00001 diff --git a/gui/slick/interfaces/default/config_providers.tmpl b/gui/slick/interfaces/default/config_providers.tmpl index 7a1f89cc..d52ebd20 100644 --- a/gui/slick/interfaces/default/config_providers.tmpl +++ b/gui/slick/interfaces/default/config_providers.tmpl @@ -451,11 +451,17 @@ #end if #if $hasattr($cur_torrent_provider, 'api_key'): + #set $field_name = cur_torrent_provider.get_id() + '_api_key'
-
diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 58e7c991..89398b5b 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -27,7 +27,7 @@ from sickbeard import logger, encodingKludge as ek from . import newznab, omgwtfnzbs # torrent from . import alpharatio, alphareign, beyondhd, bithdtv, bitmetv, blutopia, btn, btscene, dh, ettv, eztv, \ - fano, filelist, funfile, grabtheinfo, hdbits, hdme, hdspace, hdtorrents, \ + fano, filelist, funfile, grabtheinfo, hdbits, hdme, hdspace, hdtorrents, immortalseed, \ iptorrents, limetorrents, magnetdl, morethan, nebulance, ncore, nyaa, pisexy, potuk, pretome, privatehd, ptf, \ rarbg, revtt, scenehd, scenetime, shazbat, showrss, skytorrents, speedcd, \ thepiratebay, torlock, torrentday, torrenting, torrentleech, \ @@ -62,6 +62,7 @@ __all__ = ['omgwtfnzbs', 'hdme', 'hdspace', 'hdtorrents', + 'immortalseed', 'iptorrents', 'limetorrents', 'magnetdl', diff --git a/sickbeard/providers/immortalseed.py b/sickbeard/providers/immortalseed.py new file mode 100644 index 00000000..619e703b --- /dev/null +++ b/sickbeard/providers/immortalseed.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# +# Author: SickGear +# +# This file is part of SickGear. +# +# SickGear is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SickGear is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with SickGear. If not, see . + +import re +import time + +from . import generic +from sickbeard.helpers import tryInt +from lib.unidecode import unidecode +import feedparser +import sickbeard + + +class ImmortalSeedProvider(generic.TorrentProvider): + + def __init__(self): + + generic.TorrentProvider.__init__(self, 'ImmortalSeed') + + self.url_base = 'https://immortalseed.me/' + self.urls = {'config_provider_home_uri': self.url_base, + 'search': self.url_base + 'rss.php?feedtype=download&timezone=0&showrows=100' + '&%s&categories=%s&incl=%s'} + + self.categories = {'Season': [6, 4], 'Episode': [8, 48, 9], 'anime': [32]} + self.categories['Cache'] = self.categories['Season'] + self.categories['Episode'] + + self.url = self.urls['config_provider_home_uri'] + + self.api_key, self.minseed, self.minleech = 3 * [None] + + def _check_auth(self, **kwargs): + try: + secret_key = 'secret_key=' + re.split('secret_key\s*=\s*([0-9a-zA-Z]+)', self.api_key)[1] + except (StandardError, Exception): + raise sickbeard.exceptions.AuthException('Invalid secret key for %s in Media Providers/Options' % self.name) + + if secret_key != self.api_key: + self.api_key = secret_key + sickbeard.save_config() + + return True + + def _search_provider(self, search_params, **kwargs): + + results = [] + + items = {'Cache': [], 'Season': [], 'Episode': [], 'Propers': []} + + rc = dict((k, re.compile('(?i)' + v)) for (k, v) in { + 'seed': 'seed[^\d/]+([\d]+)', 'leech': 'leech[^\d/]+([\d]+)', + 'size': 'size[^\d/]+([^/]+)', 'get': '(.*download.*)', 'title': 'NUKED\b\.(.*)$'}.items()) + for mode in search_params.keys(): + for search_string in search_params[mode]: + search_string = isinstance(search_string, unicode) and unidecode(search_string) or search_string + search_string = search_string.replace(' ', '.') + + search_url = self.urls['search'] % ( + self.api_key, self._categories_string(mode, template='%s', delimiter=','), search_string) + + resp = self.get_url(search_url) + if self.should_skip(): + return results + + data = feedparser.parse(resp) + tr = data and data.get('entries', []) or [] + + cnt = len(items[mode]) + for item in tr: + try: + seeders, leechers, size = [tryInt(n, n) for n in [ + rc[x].findall(item.summary)[0].strip() for x in 'seed', 'leech', 'size']] + if self._peers_fail(mode, seeders, leechers): + continue + title = rc['title'].sub(r'\1', item.title.strip()) + download_url = self._link(rc['get'].findall(getattr(item, 'link', ''))[0]) + except (StandardError, Exception): + continue + + if download_url and title: + items[mode].append((title, download_url, seeders, self._bytesizer(size))) + + time.sleep(1.1) + self._log_search(mode, len(items[mode]) - cnt, search_url) + + results = self._sort_seeding(mode, results + items[mode]) + + return results + + def ui_string(self, key): + return ('%s_api_key' % self.get_id()) == key and 'Secret key' or \ + ('%s_api_key_tip' % self.get_id()) == key and \ + '\'secret_key=\' from the generated RSS link at %s' % \ + (self.url_base, self.name) or '' + + +provider = ImmortalSeedProvider()