Fix ETTV torrent provider.

This commit is contained in:
JackDandy 2018-04-17 15:26:17 +01:00
parent 64806ad1f6
commit aa0933209e
3 changed files with 31 additions and 4 deletions

View file

@ -1,4 +1,9 @@
### 0.15.11 (2018-04-16 03:20:00 UTC)
### 0.15.12 (2018-04-17 14:10:00 UTC)
* Fix ETTV torrent provider
### 0.15.11 (2018-04-16 03:20:00 UTC)
* Fix issue creating xml metadata files
* Change improve searching torrent providers AReign, EZTV, HDB, SkyT, and SCD

View file

@ -30,11 +30,12 @@ class ETTVProvider(generic.TorrentProvider):
def __init__(self):
generic.TorrentProvider.__init__(self, 'ETTV')
self.url_home = ['https://ettv.tv/']
self.url_home = ['https://www.ettv.tv/']
self.url_vars = {'search': 'torrents-search.php?%s&search=%s&sort=id&order=desc'}
self.url_tmpl = {'config_provider_home_uri': '%(home)s', 'search': '%(home)s%(vars)s'}
self.url_drop = ['http://et']
self.categories = {'Season': [7], 'Episode': [41, 5, 50]}
self.categories = {'Season': [7], 'Episode': [41, 5, 50, 72, 77]}
self.categories['Cache'] = self.categories['Season'] + self.categories['Episode']
self.minseed, self.minleech = 2 * [None]
@ -59,7 +60,7 @@ class ETTVProvider(generic.TorrentProvider):
search_string = isinstance(search_string, unicode) and unidecode(search_string) or search_string
search_url = self.urls['search'] % (
self._categories_string(mode), ('%2B ', '')['Cache' == mode] + '.'.join(search_string.split()))
self._categories_string(mode), search_string)
html = self.get_url(search_url)
if self.should_skip():
@ -105,10 +106,27 @@ class ETTVProvider(generic.TorrentProvider):
self._log_search(mode, len(items[mode]) - cnt, search_url)
if len(items[mode]):
break
results = self._sort_seeding(mode, results + items[mode])
return results
@staticmethod
def change_params(params):
for x, types in enumerate(params):
for y, ep_type in enumerate(types):
search_string = '.'.join(params[x][ep_type][y].split())
params[x][ep_type] = ['%2B ' + search_string, search_string]
return params
def _season_strings(self, ep_obj, **kwargs):
return self.change_params(super(ETTVProvider, self)._season_strings(ep_obj, **kwargs))
def _episode_strings(self, ep_obj, **kwargs):
return self.change_params(super(ETTVProvider, self)._episode_strings(ep_obj, **kwargs))
def get_data(self, url):
result = None
html = self.get_url(url, timeout=90)

View file

@ -1444,6 +1444,10 @@ class TorrentProvider(GenericProvider):
url_list = ['%s/' % x.rstrip('/') for x in url_list]
last_url, expire = sickbeard.PROVIDER_HOMES.get(self.get_id(), ('', None))
url_drop = getattr(self, 'url_drop', [])
if url_drop and any([url in last_url for url in url_drop]): # deprecate url
last_url = ''
if 'site down' == last_url:
if expire and (expire > int(time.time())) or not self.enabled:
return None