From 06fec4db070b24e0d4e69bb1794ed888ef826282 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 4 May 2016 16:22:13 +0100 Subject: [PATCH] Add provider Anizb. --- CHANGES.md | 1 + gui/slick/images/providers/anizb.png | Bin 0 -> 404 bytes sickbeard/providers/__init__.py | 3 +- sickbeard/providers/anizb.py | 72 +++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 gui/slick/images/providers/anizb.png create mode 100644 sickbeard/providers/anizb.py 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 0000000000000000000000000000000000000000..172af16e166dae7e77f6d53ced5975c35e18f506 GIT binary patch literal 404 zcmV;F0c-w=P)1&nL%%q--t;r9q0@EHKWc0kMq;=qbV(kBc6FKZ`&$pB7( zS<7(~0MhC30Vo4cx|@!Ph!PPM%M@1w>xEdRD6vfO!jJWX0bn`q0Z_6WcUO1xqAP6- z8lpdgxb|yWa0ZAXQXM4V-$FzCy5+bga10V^D|J4sfM2Nslz_-L#>;Z6dHcM7c-dBl z*(3K0*zpDG+P?xHKt$j)-@G?#p^3de-g?rXfq#TIUiyW8s?W#QIrTiHNcs yHw@eXn_kv#1$R_Z=_z2kM{>(7~uNBB?x0000. + +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()