From a96bdf1d3d27edae1de2807ef1066bc2ea9c03bf Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 24 Jun 2015 19:53:41 +0100 Subject: [PATCH] Add Strike torrent provider. --- CHANGES.md | 1 + gui/slick/images/providers/strike.png | Bin 0 -> 417 bytes sickbeard/__init__.py | 2 +- sickbeard/providers/__init__.py | 1 + sickbeard/providers/strike.py | 82 ++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 gui/slick/images/providers/strike.png create mode 100644 sickbeard/providers/strike.py diff --git a/CHANGES.md b/CHANGES.md index d7481a83..ee670737 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -54,6 +54,7 @@ * Add MoreThan torrent provider * Add AlphaRatio torrent provider * Add PiSexy torrent provider +* Add Strike torrent provider * Fix getManualSearchStatus: object has no attribute 'segment' * Change handling of general HTTP error response codes to prevent issues * Add handling for CloudFlare custom HTTP response codes diff --git a/gui/slick/images/providers/strike.png b/gui/slick/images/providers/strike.png new file mode 100644 index 0000000000000000000000000000000000000000..a857f5ff2ff01a19cacb5317669646091a10348b GIT binary patch literal 417 zcmV;S0bc%zP)`iy$H?tZY`oAuMa@rWBDNa)pJ}A=Z*2 zq!3AAyGO9FkRUwd6H?Y20krl9zA~ zy%5ve5YweY0sGVqF?|m)4Qt7tYRU8HV-RBMwu>k2cm~g~7-G7QyI3>M=fC=+Lb`$t z<2+trF2wX21N^8ZZ%taEt)H014Lro<20A#(!6{tC2Ry;9ab~l4(fl0>=;ItVjdNMS zFLZ0k!@Z(5U>A#cQ%mlJm@YJvI(Sq|e&3$b2HeJZ?1Y$>jqhLu4{FJOCfWQa#9Hz< zT*Z20zf((IJ*auVgWn;h1uSD5w`$3s4{DkO=;00?*OJ$#Y24FaDr;}x-)Gz-00000 LNkvXXu0mjf;U>63 literal 0 HcmV?d00001 diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 56a0b114..2524267b 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -37,7 +37,7 @@ from sickbeard import providers, metadata, config, webserveInit from sickbeard.providers.generic import GenericProvider from providers import btn, newznab, womble, thepiratebay, torrentleech, kat, iptorrents, \ omgwtfnzbs, scc, torrentday, hdbits, speedcd, nyaatorrents, torrentbytes, \ - freshontv, bitsoup, tokyotoshokan, animenzb, totv, rarbg, morethan, alpharatio, pisexy + freshontv, bitsoup, tokyotoshokan, animenzb, totv, rarbg, morethan, alpharatio, pisexy, strike from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator, \ naming_ep_type, minimax from sickbeard import searchBacklog, showUpdater, versionChecker, autoPostProcesser, \ diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 866dae2e..ade7930d 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -38,6 +38,7 @@ __all__ = ['womble', 'morethan', 'alpharatio', 'pisexy', + 'strike' ] from os import sys diff --git a/sickbeard/providers/strike.py b/sickbeard/providers/strike.py new file mode 100644 index 00000000..8b6dd6e9 --- /dev/null +++ b/sickbeard/providers/strike.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# +# 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 datetime + +from . import generic + + +class StrikeProvider(generic.TorrentProvider): + + def __init__(self): + generic.TorrentProvider.__init__(self, 'Strike') + + self.url_base = 'https://getstrike.net/' + self.urls = {'config_provider_home_uri': self.url_base, + 'search': self.url_base + 'api/v2/torrents/search/?category=TV&phrase=%s'} + + self.url = self.urls['config_provider_home_uri'] + + self.minseed, self.minleech = 2 * [None] + + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): + + results = [] + if not self._checkAuth(): + return results + + for mode in search_params.keys(): + for search_string in search_params[mode]: + + search_url = self.urls['search'] % search_string.replace(' ', '+') + data_json = self.getURL(search_url, json=True) + + cnt = len(results) + try: + for item in data_json['torrents']: + seeders = ('seeds' in item and item['seeds']) or 0 + leechers = ('leeches' in item and item['leeches']) or 0 + if seeders < self.minseed or leechers < self.minleech: + continue + + title = ('torrent_title' in item and item['torrent_title']) or '' + download_url = ('magnet_uri' in item and item['magnet_uri']) or '' + if title and download_url: + results.append((title, download_url, seeders)) + except Exception: + pass + self._log_result(mode, len(results) - cnt, search_url) + + # Sort results by seeders + results.sort(key=lambda tup: tup[2], reverse=True) + + return results + + def findPropers(self, search_date=datetime.datetime.today()): + + return self._find_propers(search_date) + + def _get_season_search_strings(self, ep_obj, **kwargs): + + return generic.TorrentProvider._get_season_search_strings(self, ep_obj, scene=False) + + def _get_episode_search_strings(self, ep_obj, add_string='', **kwargs): + + return generic.TorrentProvider._get_episode_search_strings(self, ep_obj, add_string, scene=False, use_or=False) + + +provider = StrikeProvider()