Merge branch 'feature/AddProvIS' into develop

This commit is contained in:
JackDandy 2018-05-17 04:12:19 +01:00
commit dcd956323f
5 changed files with 125 additions and 4 deletions

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

View file

@ -451,11 +451,17 @@
</div>
#end if
#if $hasattr($cur_torrent_provider, 'api_key'):
#set $field_name = cur_torrent_provider.get_id() + '_api_key'
<div class="field-pair">
<label for="${cur_torrent_provider.get_id()}_api_key">
<span class="component-title">Api key:</span>
<label for="$field_name">
#set $url_label = callable(getattr(cur_torrent_provider, 'ui_string', None)) and cur_torrent_provider.ui_string($field_name) or 'Api key'
<span class="component-title">$url_label</span>
<span class="component-desc">
<input type="text" name="${cur_torrent_provider.get_id()}_api_key" id="${cur_torrent_provider.get_id()}_api_key" value="<%= starify(cur_torrent_provider.api_key) %>" class="form-control input-sm input350" />
<input type="text" name="$field_name" id="$field_name" value="<%= starify(cur_torrent_provider.api_key) %>" class="form-control input-sm input350" />
#if callable(getattr(cur_torrent_provider, 'ui_string', None))
#set $tip_text = cur_torrent_provider.ui_string($field_name + '_tip')
<div class="clear-left"><p>$tip_text</p></div>
#end if
</span>
</label>
</div>

View file

@ -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',

View file

@ -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 <http://www.gnu.org/licenses/>.
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 <a href="%sgetrss.php">generated RSS link</a> at %s' % \
(self.url_base, self.name) or ''
provider = ImmortalSeedProvider()