diff --git a/CHANGES.md b/CHANGES.md index d517348d..aa3509a7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * Add ToTV provider * Fix Backlog scheduler initialization and change backlog frequency from minutes to days +* Change to consolidate and tidy some provider code ### 0.8.1 (2015-04-15 04:16:00 UTC) diff --git a/gui/slick/images/providers/animenzb.gif b/gui/slick/images/providers/animenzb.gif deleted file mode 100644 index 7a8bfeb9..00000000 Binary files a/gui/slick/images/providers/animenzb.gif and /dev/null differ diff --git a/gui/slick/images/providers/animenzb.png b/gui/slick/images/providers/animenzb.png new file mode 100644 index 00000000..4fd6707b Binary files /dev/null and b/gui/slick/images/providers/animenzb.png differ diff --git a/gui/slick/images/providers/kat.png b/gui/slick/images/providers/kickasstorrents.png similarity index 100% rename from gui/slick/images/providers/kat.png rename to gui/slick/images/providers/kickasstorrents.png diff --git a/gui/slick/images/providers/scc.png b/gui/slick/images/providers/sceneaccess.png similarity index 100% rename from gui/slick/images/providers/scc.png rename to gui/slick/images/providers/sceneaccess.png diff --git a/gui/slick/images/providers/thepiratebay.png b/gui/slick/images/providers/the_pirate_bay.png similarity index 100% rename from gui/slick/images/providers/thepiratebay.png rename to gui/slick/images/providers/the_pirate_bay.png diff --git a/sickbeard/providers/animenzb.py b/sickbeard/providers/animenzb.py index 0236b79b..37923547 100644 --- a/sickbeard/providers/animenzb.py +++ b/sickbeard/providers/animenzb.py @@ -36,7 +36,6 @@ class animenzb(generic.NZBProvider): generic.NZBProvider.__init__(self, 'animenzb') self.supportsBacklog = False - self.supportsAbsoluteNumbering = True self.anime_only = True self.enabled = False @@ -45,12 +44,6 @@ class animenzb(generic.NZBProvider): self.url = 'http://animenzb.com/' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'animenzb.gif' - def _get_season_search_strings(self, ep_obj): return [x for x in show_name_helpers.makeSceneSeasonSearchString(self.show, ep_obj)] @@ -124,7 +117,7 @@ class animenzbCache(tvcache.TVCache): tvcache.TVCache.__init__(self, provider) - + self.minTime = 20 def _getRSSData(self): diff --git a/sickbeard/providers/bitsoup.py b/sickbeard/providers/bitsoup.py index 38cfb82c..2f5ff05b 100644 --- a/sickbeard/providers/bitsoup.py +++ b/sickbeard/providers/bitsoup.py @@ -64,12 +64,6 @@ class BitSoupProvider(generic.TorrentProvider): self.categories = "&c42=1&c45=1&c49=1&c7=1" - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'bitsoup.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index f0884026..6d563400 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -39,8 +39,6 @@ class BTNProvider(generic.TorrentProvider): generic.TorrentProvider.__init__(self, "BTN") self.supportsBacklog = True - self.supportsAbsoluteNumbering = True - self.enabled = False self.api_key = None self.ratio = None @@ -49,12 +47,6 @@ class BTNProvider(generic.TorrentProvider): self.url = "http://api.btnapps.net" - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'btn.png' - def _checkAuth(self): if not self.api_key: raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.") diff --git a/sickbeard/providers/ezrss.py b/sickbeard/providers/ezrss.py index 9659c8f2..70cc299b 100644 --- a/sickbeard/providers/ezrss.py +++ b/sickbeard/providers/ezrss.py @@ -47,12 +47,6 @@ class EZRSSProvider(generic.TorrentProvider): self.url = 'https://www.ezrss.it/' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'ezrss.png' - def getQuality(self, item, anime=False): filename = item.filename diff --git a/sickbeard/providers/freshontv.py b/sickbeard/providers/freshontv.py index ae7a87fc..2ebae8fd 100755 --- a/sickbeard/providers/freshontv.py +++ b/sickbeard/providers/freshontv.py @@ -64,12 +64,6 @@ class FreshOnTVProvider(generic.TorrentProvider): self.url = self.urls['base_url'] self.cookies = None - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'freshontv.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index f2a401a1..abb82002 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -51,11 +51,11 @@ class GenericProvider: self.show = None self.supportsBacklog = False - self.supportsAbsoluteNumbering = False self.anime_only = False self.search_mode = None self.search_fallback = False + self.enabled = False self.enable_recentsearch = False self.enable_backlog = False @@ -97,7 +97,7 @@ class GenericProvider: """ This should be overridden and should return the config setting eg. sickbeard.MYPROVIDER """ - return False + return self.enabled def getResult(self, episodes): """ diff --git a/sickbeard/providers/hdbits.py b/sickbeard/providers/hdbits.py index 3f4e5451..aa397d88 100644 --- a/sickbeard/providers/hdbits.py +++ b/sickbeard/providers/hdbits.py @@ -1,16 +1,16 @@ # 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. -# +# 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 +# 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 re @@ -55,9 +55,6 @@ class HDBitsProvider(generic.TorrentProvider): self.rss_url = 'https://hdbits.org/api/torrents' self.download_url = 'https://hdbits.org/download.php?' - def isEnabled(self): - return self.enabled - def _checkAuth(self): if not self.username or not self.passkey: @@ -201,7 +198,7 @@ class HDBitsCache(tvcache.TVCache): tvcache.TVCache.__init__(self, provider) - # only poll HDBits every 15 minutes max + # only poll HDBits every 15 minutes max self.minTime = 15 def _getRSSData(self): @@ -216,5 +213,4 @@ class HDBitsCache(tvcache.TVCache): return [] - -provider = HDBitsProvider() +provider = HDBitsProvider() diff --git a/sickbeard/providers/hdtorrents.py b/sickbeard/providers/hdtorrents.py index 6795843e..a18e86e3 100644 --- a/sickbeard/providers/hdtorrents.py +++ b/sickbeard/providers/hdtorrents.py @@ -71,12 +71,6 @@ class HDTorrentsProvider(generic.TorrentProvider): self.cookies = None - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'hdtorrents.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0]) diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index d5bc7d1f..fdceba10 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -63,12 +63,6 @@ class IPTorrentsProvider(generic.TorrentProvider): self.categorie = 'l73=1&l78=1&l66=1&l65=1&l79=1&l5=1&l4=1' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'iptorrents.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index 1862bec5..4a9d6c1a 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -64,12 +64,6 @@ class KATProvider(generic.TorrentProvider): self.urls = ['https://kat.ph/', 'http://katproxy.com/', 'http://www.kickmirror.com/'] self.url = 'https://kat.ph/' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'kat.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 0b04ad9c..b93b2bc2 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -86,9 +86,6 @@ class NewznabProvider(generic.NZBProvider): return self.getID() + '.png' return 'newznab.png' - def isEnabled(self): - return self.enabled - def _getURL(self, url, post_data=None, params=None, timeout=30, json=False): """ By default this is just a simple urlopen call but this method should be overridden @@ -218,7 +215,7 @@ class NewznabProvider(generic.NZBProvider): params['q'] = helpers.sanitizeSceneName(cur_exception) paramsNoEp = params.copy() - paramsNoEp['q'] = paramsNoEp['q'] + " " + str(paramsNoEp['ep']) + paramsNoEp['q'] = '%s.%02d' % (paramsNoEp['q'], paramsNoEp['ep']) if "ep" in paramsNoEp: paramsNoEp.pop("ep") to_return.append(paramsNoEp) diff --git a/sickbeard/providers/nextgen.py b/sickbeard/providers/nextgen.py index c2060280..6596a470 100644 --- a/sickbeard/providers/nextgen.py +++ b/sickbeard/providers/nextgen.py @@ -71,12 +71,6 @@ class NextGenProvider(generic.TorrentProvider): self.login_opener = None - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'nextgen.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/nyaatorrents.py b/sickbeard/providers/nyaatorrents.py index 095e40a8..123b06c3 100644 --- a/sickbeard/providers/nyaatorrents.py +++ b/sickbeard/providers/nyaatorrents.py @@ -35,7 +35,6 @@ class NyaaProvider(generic.TorrentProvider): generic.TorrentProvider.__init__(self, "NyaaTorrents") self.supportsBacklog = True - self.supportsAbsoluteNumbering = True self.anime_only = True self.enabled = False self.ratio = None @@ -44,12 +43,6 @@ class NyaaProvider(generic.TorrentProvider): self.url = 'http://www.nyaa.se/' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'nyaatorrents.png' - def getQuality(self, item, anime=False): title = item.title quality = Quality.sceneQuality(title, anime) diff --git a/sickbeard/providers/omgwtfnzbs.py b/sickbeard/providers/omgwtfnzbs.py index 96070a26..2d4d0dd3 100644 --- a/sickbeard/providers/omgwtfnzbs.py +++ b/sickbeard/providers/omgwtfnzbs.py @@ -49,9 +49,6 @@ class OmgwtfnzbsProvider(generic.NZBProvider): self.url = 'https://omgwtfnzbs.org/' self.supportsBacklog = True - def isEnabled(self): - return self.enabled - def _checkAuth(self): if not self.username or not self.api_key: diff --git a/sickbeard/providers/rsstorrent.py b/sickbeard/providers/rsstorrent.py index d65e33be..08f83449 100644 --- a/sickbeard/providers/rsstorrent.py +++ b/sickbeard/providers/rsstorrent.py @@ -69,9 +69,6 @@ class TorrentRssProvider(generic.TorrentProvider): return self.getID() + '.png' return 'torrentrss.png' - def isEnabled(self): - return self.enabled - def _get_title_and_url(self, item): title, url = None, None diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index 41e4a52b..534e6a2d 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -66,12 +66,6 @@ class SCCProvider(generic.TorrentProvider): self.categories = 'c27=27&c17=17&c11=11' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'scc.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py index cb73770b..571eba1a 100644 --- a/sickbeard/providers/speedcd.py +++ b/sickbeard/providers/speedcd.py @@ -66,12 +66,6 @@ class SpeedCDProvider(generic.TorrentProvider): self.categories = {'Season': {'c14': 1}, 'Episode': {'c2': 1, 'c49': 1}, 'RSS': {'c14': 1, 'c2': 1, 'c49': 1}} - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'speedcd.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index 9eaaf9c2..6bdc5f18 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -59,12 +59,6 @@ class ThePirateBayProvider(generic.TorrentProvider): self.re_title_url = '/torrent/(?P\d+)/(?P.*?)//1".+?(?P<url>magnet.*?)//1".+?(?P<seeders>\d+)</td>.+?(?P<leechers>\d+)</td>' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'thepiratebay.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/tokyotoshokan.py b/sickbeard/providers/tokyotoshokan.py index 77df1756..70b3f600 100644 --- a/sickbeard/providers/tokyotoshokan.py +++ b/sickbeard/providers/tokyotoshokan.py @@ -37,7 +37,6 @@ class TokyoToshokanProvider(generic.TorrentProvider): generic.TorrentProvider.__init__(self, "TokyoToshokan") self.supportsBacklog = True - self.supportsAbsoluteNumbering = True self.anime_only = True self.enabled = False self.ratio = None @@ -46,12 +45,6 @@ class TokyoToshokanProvider(generic.TorrentProvider): self.url = 'http://tokyotosho.info/' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'tokyotoshokan.png' - def _get_title_and_url(self, item): title, url = item @@ -105,19 +98,19 @@ class TokyoToshokanProvider(generic.TorrentProvider): with BS4Parser(data, features=["html5lib", "permissive"]) as soup: torrent_table = soup.find('table', attrs={'class': 'listing'}) torrent_rows = torrent_table.find_all('tr') if torrent_table else [] - if torrent_rows: + if torrent_rows: if torrent_rows[0].find('td', attrs={'class': 'centertext'}): a = 1 else: a = 0 - + for top, bottom in zip(torrent_rows[a::2], torrent_rows[a::2]): title = top.find('td', attrs={'class': 'desc-top'}).text url = top.find('td', attrs={'class': 'desc-top'}).find('a')['href'] - + if not title or not url: continue - + item = title.lstrip(), url results.append(item) diff --git a/sickbeard/providers/torrentbytes.py b/sickbeard/providers/torrentbytes.py index d0b9fde0..7ecde633 100644 --- a/sickbeard/providers/torrentbytes.py +++ b/sickbeard/providers/torrentbytes.py @@ -64,12 +64,6 @@ class TorrentBytesProvider(generic.TorrentProvider): self.categories = '&c41=1&c33=1&c38=1&c32=1&c37=1' - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'torrentbytes.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 2aff7da1..a8a7e435 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -66,12 +66,6 @@ class TorrentDayProvider(generic.TorrentProvider): self.categories = {'Season': {'c14': 1}, 'Episode': {'c2': 1, 'c26': 1, 'c7': 1, 'c24': 1}, 'RSS': {'c2': 1, 'c26': 1, 'c7': 1, 'c24': 1, 'c14': 1}} - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'torrentday.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/torrentleech.py b/sickbeard/providers/torrentleech.py index 11a8160f..9295d3d7 100644 --- a/sickbeard/providers/torrentleech.py +++ b/sickbeard/providers/torrentleech.py @@ -67,12 +67,6 @@ class TorrentLeechProvider(generic.TorrentProvider): self.categories = "2,26,27,32" - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'torrentleech.png' - def getQuality(self, item, anime=False): quality = Quality.sceneQuality(item[0], anime) diff --git a/sickbeard/providers/totv.py b/sickbeard/providers/totv.py index 607a1c5a..457cde1e 100644 --- a/sickbeard/providers/totv.py +++ b/sickbeard/providers/totv.py @@ -30,7 +30,6 @@ class ToTVProvider(generic.TorrentProvider): generic.TorrentProvider.__init__(self, 'ToTV') self.supportsBacklog = True - self.supportsAbsoluteNumbering = True self.enabled = False self.api_key = None @@ -42,12 +41,6 @@ class ToTVProvider(generic.TorrentProvider): self.download_url = 'http://titansof.tv/api/torrents/%s/download?apikey=%s' self.session = requests.Session() - def isEnabled(self): - return self.enabled - - def imageName(self): - return 'totv.png' - def _checkAuth(self): if not self.api_key: raise AuthException('Your authentication credentials for ' + self.name + ' are missing, check your config.') diff --git a/sickbeard/providers/womble.py b/sickbeard/providers/womble.py index c55b7bb4..e6be030c 100644 --- a/sickbeard/providers/womble.py +++ b/sickbeard/providers/womble.py @@ -29,9 +29,6 @@ class WombleProvider(generic.NZBProvider): self.cache = WombleCache(self) self.url = 'http://newshost.co.za/' - def isEnabled(self): - return self.enabled - class WombleCache(tvcache.TVCache): def __init__(self, provider):