diff --git a/CHANGES.md b/CHANGES.md index bffba035..cc759918 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -75,6 +75,7 @@ * Change remove some logging cruft * Fix post processing "Force already processed" processing only the first of multiple files * Add FileList torrent provider +* Add provider Anizb ### 0.11.11 (2016-04-05 19:20:00 UTC) diff --git a/gui/slick/images/providers/anizb.png b/gui/slick/images/providers/anizb.png new file mode 100644 index 00000000..172af16e Binary files /dev/null and b/gui/slick/images/providers/anizb.png differ diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 9081ed07..007d8747 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -26,7 +26,7 @@ from sickbeard import logger, encodingKludge as ek # usenet from . import newznab, omgwtfnzbs, womble # torrent -from . import alpharatio, beyondhd, bitmetv, btn, filelist, freshontv, funfile, gftracker, grabtheinfo, \ +from . import alpharatio, anizb, beyondhd, bitmetv, btn, filelist, freshontv, funfile, gftracker, grabtheinfo, \ hd4free, hdbits, hdspace, iptorrents, kat, morethan, pisexy, pretome, rarbg, scc, scenetime, shazbat, speedcd, \ thepiratebay, torrentbytes, torrentday, torrenting, torrentleech, torrentshack, transmithe_net, tvchaosuk # anime @@ -40,6 +40,7 @@ except: __all__ = ['omgwtfnzbs', 'womble', 'alpharatio', + 'anizb', 'beyondhd', 'bitmetv', 'btn', diff --git a/sickbeard/providers/anizb.py b/sickbeard/providers/anizb.py new file mode 100644 index 00000000..79869ce7 --- /dev/null +++ b/sickbeard/providers/anizb.py @@ -0,0 +1,72 @@ +# 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 . + +from . import generic +from sickbeard import show_name_helpers, tvcache +import time + + +class AnizbProvider(generic.NZBProvider): + + def __init__(self): + generic.NZBProvider.__init__(self, 'Anizb', anime_only=True) + + self.url = 'https://anizb.org/' + self.cache = AnizbCache(self) + + def _search_provider(self, search_params, **kwargs): + + results = [] + if self.show and not self.show.is_anime: + return results + + for mode in search_params.keys(): + for params in search_params[mode]: + + search_url = '%sapi/%s' % (self.url, params and ('?q=%s' % params) or '') + data = self.cache.getRSSFeed(search_url) + time.sleep(1.1) + + cnt = len(results) + for entry in (data and data.get('entries', []) or []): + if entry.get('title') and entry.get('link', '').startswith('http'): + results.append((entry['title'], entry['link'], None, None)) + + self.log_result(mode=mode, count=len(results) - cnt, url=search_url) + + return list(set(results)) + + def _season_strings(self, ep_obj, **kwargs): + return [{'Season': [ + x.replace('.', ' ') for x in show_name_helpers.makeSceneSeasonSearchString(self.show, ep_obj)]}] + + def _episode_strings(self, ep_obj, **kwargs): + return [{'Episode': [ + x.replace('.', ' ') for x in show_name_helpers.makeSceneSearchString(self.show, ep_obj)]}] + + +class AnizbCache(tvcache.TVCache): + + def __init__(self, this_provider): + tvcache.TVCache.__init__(self, this_provider) + self.update_freq = 6 + + def _cache_data(self): + return self.provider.cache_data() + + +provider = AnizbProvider()