From c371630d8a8a2ed6ca85b71426adc925e4929f1d Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 12 Feb 2015 23:46:21 +0800 Subject: [PATCH] Fix for issue #425: Replace TVTorrents Provider with Shazbat.tv --- gui/slick/images/providers/shazbat.png | Bin 0 -> 853 bytes sickbeard/__init__.py | 2 +- sickbeard/providers/__init__.py | 1 + sickbeard/providers/shazbat.py | 93 +++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 gui/slick/images/providers/shazbat.png create mode 100644 sickbeard/providers/shazbat.py diff --git a/gui/slick/images/providers/shazbat.png b/gui/slick/images/providers/shazbat.png new file mode 100644 index 0000000000000000000000000000000000000000..8f86095cc25f5867d34897e72bf0313eed33cba4 GIT binary patch literal 853 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D%zBQrxHN+NuH ztdjF{^%7I^lT!66atnZ}7#M6Stboki)RIJnirk#MVyg;UC9n!BAR8pCucQE0Qj%?} z6yY17;GAESs$i;TqGzCF$EBd4U{jQmW)z9|8>y;bpKhp88yV>WRp=I1=9MH?=;jqGLkxkLMfuL^+7WFhI$72aI=A0Z9t+{{zaLoK$}74+Zoz`RicPN?Xl4Z zS&rlwh)=LyGdS{M`=v=?$OG3167VX^Pwm9+g&pUSW``2F2 zUVSxdTZGP=qMZ>Uu5I_TwobbL_~VAxU$Y7)sc^k0+a0zt!%YBU_EvCC)K zb3Z?O`)#2*yZM`r-psjXG_yyx-<|Vmk)`JMD%;07n{P&JjoSLMM5}uLee+4bx&m1x z?-cFSVUjtZEy5MH{<>?^{M(#uU9}1x)rylW`gm>jO)-|?d)mRP)Y5fykt`qkS5<)q z&&eE39O_0Jmh<0;nBsBr$7f!a=bt0lHYsemo459ARx9TPW|s2ZbC0BNo_U0s@vAlC z%om*1Vl(%IpG^ziyKu?vx8HmZtU38ESfc;tT`qQz2*|d85%DMIb zg*bZcRk&?0to5>fAFOafUPFMX+C)n8bKU;w0SXG%#s6(tFGS8!bmII`lpWdlpl<)` zq6YWRCl0JQ;h|7`+-{~%$w{{6#y5=)MK8N6g&(+Fd0U;cZ+S}C6uG+ioSFZ=pW3lI f{om_*fA=x`p5o%?`9&U-PZ&I1{an^LB{Ts5=ZH|` literal 0 HcmV?d00001 diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 8ab13859..c3fa13d3 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -34,7 +34,7 @@ from sickbeard import providers, metadata, config, webserveInit from sickbeard.providers.generic import GenericProvider from providers import ezrss, btn, newznab, womble, thepiratebay, torrentleech, kat, iptorrents, \ omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, nextgen, speedcd, nyaatorrents, fanzub, torrentbytes, animezb, \ - freshontv, bitsoup, t411, tokyotoshokan + freshontv, bitsoup, t411, tokyotoshokan, shazbat from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator, \ naming_ep_type from sickbeard import searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, \ diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 8c6ffc66..59f9bb9c 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -39,6 +39,7 @@ __all__ = ['ezrss', 'bitsoup', 't411', 'tokyotoshokan', + 'shazbat', ] import sickbeard diff --git a/sickbeard/providers/shazbat.py b/sickbeard/providers/shazbat.py new file mode 100644 index 00000000..d723a838 --- /dev/null +++ b/sickbeard/providers/shazbat.py @@ -0,0 +1,93 @@ +# Author: Nic Wolfe +# URL: http://code.google.com/p/sickbeard/ +# +# 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 . + +try: + import xml.etree.cElementTree as etree +except ImportError: + import elementtree.ElementTree as etree + +import sickbeard +import generic + +from sickbeard.exceptions import ex, AuthException +from sickbeard import helpers +from sickbeard import logger +from sickbeard import tvcache + + +class ShazbatProvider(generic.TorrentProvider): + def __init__(self): + + generic.TorrentProvider.__init__(self, "Shazbat.tv") + + self.supportsBacklog = False + + self.enabled = False + self.passkey = None + self.ratio = None + self.options = None + + self.cache = ShazbatCache(self) + + self.urls = {'base_url': 'http://www.shazbat.tv/'} + self.url = self.urls['base_url'] + + def isEnabled(self): + return self.enabled + + def imageName(self): + return 'shazbat.png' + + def _checkAuth(self): + if not self.passkey: + raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.") + + return True + + def _checkAuthFromData(self, data): + if not self.passkey: + self._checkAuth() + elif not (data['entries'] and data['feed']): + logger.log(u"Incorrect authentication credentials for " + self.name, logger.DEBUG) + raise AuthException( + u"Your authentication credentials for " + self.name + " are incorrect, check your config") + + return True + + def seedRatio(self): + return self.ratio + + +class ShazbatCache(tvcache.TVCache): + def __init__(self, provider): + tvcache.TVCache.__init__(self, provider) + + # only poll Shazbat feed every 15 minutes max + self.minTime = 15 + + def _getRSSData(self): + + rss_url = self.provider.url + 'rss/recent?passkey=' + provider.passkey + '&fname=true' + logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) + + return self.getRSSFeed(rss_url, items=['entries', 'feed']) + + def _checkAuth(self, data): + return self.provider._checkAuthFromData(data) + +provider = ShazbatProvider()