diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index c19b15b1c0..431cf393ce 100644 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -1,7 +1,6 @@ # coding=utf-8 # Author: Nic Wolfe # - # # This file is part of SickRage. # @@ -23,7 +22,7 @@ import sickbeard from sickbeard.providers import btn, womble, thepiratebay, torrentleech, kat, iptorrents, torrentz, \ - omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, speedcd, nyaatorrents, bluetigers, xthor, abnormal, phxbit, torrentbytes, cpasbien,\ + omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, speedcd, nyaatorrents, bluetigers, xthor, abnormal, torrentbytes, cpasbien,\ freshontv, morethantv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch, torrentproject, extratorrent, \ scenetime, btdigg, transmitthenet, tvchaosuk, bitcannon, pretome, gftracker, hdspace, newpct, elitetorrent, bitsnoop, danishbits, hd4free, limetorrents, \ norbits, ilovetorrents, sceneelite, anizb @@ -34,7 +33,7 @@ 'speedcd', 'nyaatorrents', 'torrentbytes', 'freshontv', 'cpasbien', 'morethantv', 'bitsoup', 't411', 'tokyotoshokan', 'alpharatio', 'shazbat', 'rarbg', 'tntvillage', 'binsearch', 'bluetigers', - 'xthor', 'abnormal', 'phxbit', 'scenetime', 'btdigg', 'transmitthenet', 'tvchaosuk', + 'xthor', 'abnormal', 'scenetime', 'btdigg', 'transmitthenet', 'tvchaosuk', 'torrentproject', 'extratorrent', 'bitcannon', 'torrentz', 'pretome', 'gftracker', 'hdspace', 'newpct', 'elitetorrent', 'bitsnoop', 'danishbits', 'hd4free', 'limetorrents', 'norbits', 'ilovetorrents', 'sceneelite', 'anizb' diff --git a/sickbeard/providers/phxbit.py b/sickbeard/providers/phxbit.py deleted file mode 100644 index 598315b0b8..0000000000 --- a/sickbeard/providers/phxbit.py +++ /dev/null @@ -1,173 +0,0 @@ -# coding=utf-8 -# Author: adaur -# - -# -# This file is part of SickRage. -# -# SickRage 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. -# -# SickRage 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 SickRage. If not, see . - -import re - -from requests.compat import urljoin -from requests.utils import dict_from_cookiejar - -from sickbeard import logger, tvcache -from sickbeard.bs4_parser import BS4Parser - -from sickrage.helper.common import convert_size, try_int -from sickrage.providers.torrent.TorrentProvider import TorrentProvider - - -class PhxBitProvider(TorrentProvider): # pylint: disable=too-many-instance-attributes - - def __init__(self): - - # Provider Init - TorrentProvider.__init__(self, "PhxBit") - - # Credentials - self.username = None - self.password = None - - # Torrent Stats - self.minseed = None - self.minleech = None - - # URLs - self.url = 'https://phxbit.com' - self.urls = { - 'login': urljoin(self.url, '/connect.php'), - 'search': urljoin(self.url, '/sphinx.php') - } - - # Proper Strings - self.proper_strings = ['PROPER'] - - # Cache - self.cache = tvcache.TVCache(self, min_time=30) - - def login(self): - if any(dict_from_cookiejar(self.session.cookies).values()): - return True - - login_params = { - 'username': self.username, - 'password': self.password, - } - - response = self.get_url(self.urls['login'], post_data=login_params, returns='text') - if not response: - logger.log(u"Unable to connect to provider", logger.WARNING) - return False - - if not re.search('dons.php', response): - logger.log(u"Invalid username or password. Check your settings", logger.WARNING) - return False - - return True - - def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-many-locals, too-many-branches - results = [] - if not self.login(): - return results - - # Search Params - search_params = { - 'order': 'desc', - 'sort': 'normal', - 'group': 'series' - } - - # Units - units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] - - def process_column_header(td): - result = '' - if td.img: - result = td.img.get('alt', '') - if not result: - result = td.get_text(strip=True) - return result - - for mode in search_strings: - items = [] - logger.log(u"Search Mode: {}".format(mode), logger.DEBUG) - - for search_string in search_strings[mode]: - - if mode != 'RSS': - # Use exact=1 parameter if we're doing a backlog or forced search - search_params['exact'] = 1 - logger.log(u"Search string: {}".format(search_string.decode("utf-8")), - logger.DEBUG) - - search_params['q'] = search_string - - data = self.get_url(self.urls['search'], params=search_params, returns='text') - if not data: - continue - - with BS4Parser(data, 'html5lib') as html: - torrent_table = html.find("table") - torrent_rows = torrent_table('tr') if torrent_table else [] - - # Continue only if at least one Release is found - if len(torrent_rows) < 2: - logger.log(u"Data returned from provider does not contain any torrents", logger.DEBUG) - continue - - # Catégorie, Nom, DL, Com, Taille, C, Seed, Leech, Share - labels = [process_column_header(label) for label in torrent_rows[0]('td')] - - # Skip column headers - for result in torrent_rows[1:]: - cells = result('td') - if len(cells) < len(labels): - continue - - try: - title = cells[labels.index('Nom')].get_text(strip=True) - download_url = cells[labels.index('DL')].find('a')['href'] - if not all([title, download_url]): - continue - - seeders = try_int(cells[labels.index('Seed')].get_text(strip=True)) - leechers = try_int(cells[labels.index('Leech')].get_text(strip=True)) - - # Filter unseeded torrent - if seeders < min(self.minseed, 1) or leechers < min(self.minleech, 0): - if mode != 'RSS': - logger.log(u"Discarding torrent because it doesn't meet the minimum seeders or leechers: {} (S:{} L:{})".format(title, seeders, leechers), logger.DEBUG) - continue - - torrent_size = cells[labels.index('Taille')].get_text(strip=True) - size = convert_size(torrent_size, units=units) or -1 - - item = {'title': title, 'link': download_url, 'size': size, 'seeders': seeders, 'leechers': leechers, 'hash': None} - if mode != 'RSS': - logger.log(u"Found result: %s with %s seeders and %s leechers" % (title, seeders, leechers), logger.DEBUG) - - items.append(item) - except StandardError: - continue - - # For each search mode sort all the items by seeders if available - items.sort(key=lambda d: try_int(d.get('seeders', 0)), reverse=True) - results += items - - return results - - -provider = PhxBitProvider()