From 8f1cc177f48d91138a44f9e15764404b56754c90 Mon Sep 17 00:00:00 2001 From: labrys Date: Wed, 1 Jun 2016 01:25:01 -0400 Subject: [PATCH] Add provider Zooqle --- gui/slick/images/providers/zooqle.png | Bin 0 -> 1187 bytes sickbeard/providers/__init__.py | 4 +- sickbeard/providers/zooqle.py | 152 ++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 gui/slick/images/providers/zooqle.png create mode 100644 sickbeard/providers/zooqle.py diff --git a/gui/slick/images/providers/zooqle.png b/gui/slick/images/providers/zooqle.png new file mode 100644 index 0000000000000000000000000000000000000000..5a9c435215c9a6d564605947ee966543343d7ce3 GIT binary patch literal 1187 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+nAI{vB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxR5#hc$WX!DQqR!T z)ZE-iN5ROz&_v(BP~Xs4*U-|+#Kg+LKmiJrfVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8E%gnI^o@*kfhu&1EAvVcD|GXUm0>2hq!uR^WfqiV=I1GZOiWD5 zFD$Tv3bSNU;+l1ennz|zM-B0$V)JVzP|XC=H|jx7ncO3BHWAB;NpiyW)Z+ZoqGVvir744~DzI`cN=+=uFAB-e&w+(vKt_H^esM;Afr7I$IMft0!ZY(y z^2>`g!FqgstvvIJOA_;vQ$1a5m4K$`WoD*WSvr|om{}UR7@3|8vx86F zIq1me`*izmb${D`=MFWbFdvq`^Wf;awk11u%&82wQ{*%zQW4}h8 z{?O+x-HbYB4tEYc4G4Lm(356-hG_%a0!am-jEet`3!*P6U)iasJc}1-S4+hf ztFUI#v*7}V7g|Zw|NqCkBu~fdz1@%Y;A>ZWI=PK+sGN0*G2NjMw(-E3AIvE=^)BncQ2^e@O1TaS?83{1OQfGl>z_& literal 0 HcmV?d00001 diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index d9539edafd..f4eec2c5b9 100644 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -25,7 +25,7 @@ omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, speedcd, nyaatorrents, bluetigers, xthor, abnormal, torrentbytes, cpasbien,\ freshontv, morethantv, 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, bithdtv + norbits, ilovetorrents, sceneelite, anizb, bithdtv, zooqle __all__ = [ 'womble', 'btn', 'thepiratebay', 'kat', 'torrentleech', 'scc', 'hdtorrents', @@ -36,7 +36,7 @@ 'xthor', 'abnormal', 'scenetime', 'btdigg', 'transmitthenet', 'tvchaosuk', 'torrentproject', 'extratorrent', 'bitcannon', 'torrentz', 'pretome', 'gftracker', 'hdspace', 'newpct', 'elitetorrent', 'bitsnoop', 'danishbits', 'hd4free', 'limetorrents', - 'norbits', 'ilovetorrents', 'sceneelite', 'anizb', 'bithdtv' + 'norbits', 'ilovetorrents', 'sceneelite', 'anizb', 'bithdtv', 'zooqle' ] diff --git a/sickbeard/providers/zooqle.py b/sickbeard/providers/zooqle.py new file mode 100644 index 0000000000..9af90b84bb --- /dev/null +++ b/sickbeard/providers/zooqle.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# Author: medariox +# +# This file is part of Medusa. +# +# Medusa 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. +# +# Medusa 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 Medusa. If not, see . + +from __future__ import unicode_literals + +from requests.compat import urljoin + +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 ZooqleProvider(TorrentProvider): # pylint: disable=too-many-instance-attributes + """Zooqle Torrent provider""" + def __init__(self): + + # Provider Init + TorrentProvider.__init__(self, 'Zooqle') + + # Credentials + self.public = True + + # Torrent Stats + self.minseed = None + self.minleech = None + + # URLs + self.url = 'https://zooqle.com/' + self.urls = { + 'search': urljoin(self.url, '/search'), + } + + # Proper Strings + self.proper_strings = ['PROPER', 'REPACK', 'REAL'] + + # Cache + self.cache = tvcache.TVCache(self, min_time=15) + + def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-many-locals, too-many-branches + """ + Zooqle search and parsing + + :param search_string: A dict with mode (key) and the search value (value) + :param age: Not used + :param ep_obj: Not used + :returns: A list of search results (structure) + """ + results = [] + + # Search Params + search_params = { + 'q': '* category:TV', + 's': 'dt', + 'v': 't', + 'sd': 'd', + } + + # Units + units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] + + for mode in search_strings: + items = [] + logger.log('Search mode: {0}'.format(mode), logger.DEBUG) + + for search_string in search_strings[mode]: + + if mode != 'RSS': + search_params = {'q': '{0}+category:TV'.format(search_strings)} + + response = self.get_url(self.urls['search'], params=search_params, returns='response') + if not response.text: + logger.log('No data returned from provider', logger.DEBUG) + continue + + with BS4Parser(response.text, 'html5lib') as html: + torrent_table = html.find('div', class_='panel-body') + 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('Data returned from provider does not contain any torrents', logger.DEBUG) + continue + + # Skip column headers + for result in torrent_rows[1:]: + + try: + cells = result('td') + + title = cells[1].find('a').get_text() + download_url = cells[2].find('a')['href'] + if not all([title, download_url]): + continue + + peers = cells[6].find('div')['title'].replace(',', '').split(' | ', 1) + seeders = try_int(peers[0].strip('Seeders: ')) + leechers = try_int(peers[1].strip('Leechers: ')) + + # Filter unseeded torrent + if seeders < min(self.minseed, 1): + if mode != 'RSS': + logger.log('Discarding torrent because it doesn\'t meet the' + ' minimum seeders: {0}. Seeders: {1})'.format + (title, seeders), logger.DEBUG) + continue + + torrent_size = cells[4].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, + 'pubdate': None, + 'hash': None + } + if mode != 'RSS': + logger.log('Found result: {0} with {1} seeders and {2} leechers'.format + (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 = ZooqleProvider()