From e7b269376566ff67099f69335c45eb938282802f Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Thu, 19 Jul 2018 22:42:54 +0100 Subject: [PATCH 1/2] Change TVDB API 2 to version 2.2.0 Fix TVDB header not being send. Fix typo in Ek class fix_list_encoding(x). Change fixListEncodings for better readability. --- autoProcessTV/SickGear-NG/SickGear-NG.py | 12 +++++++++--- lib/tvdb_api/tvdb_api.py | 12 ++++++------ sickbeard/encodingKludge.py | 11 ++++++++--- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/autoProcessTV/SickGear-NG/SickGear-NG.py b/autoProcessTV/SickGear-NG/SickGear-NG.py index 261d4a5e..51147c04 100755 --- a/autoProcessTV/SickGear-NG/SickGear-NG.py +++ b/autoProcessTV/SickGear-NG/SickGear-NG.py @@ -63,7 +63,7 @@ # Send PostProcessing requests to SickGear # -# PostProcessing-Script version: 1.6. +# PostProcessing-Script version: 1.7. # @@ -157,7 +157,7 @@ import re import sys import warnings -__version__ = '1.6' +__version__ = '1.7' verbose = 0 or 'yes' == os.environ.get('NZBPO_SG_VERBOSE', 'no') @@ -281,11 +281,17 @@ class Ek: return x return None + @staticmethod + def fix_out_encoding(x): + if isinstance(x, basestring): + return Ek.fix_string_encoding(x) + return x + @staticmethod def fix_list_encoding(x): if type(x) not in (list, tuple): return x - return filter(lambda i: None is not i, map(Ek.fix_string_encoding, i)) + return filter(lambda i: None is not i, map(Ek.fix_out_encoding, x)) @staticmethod def encode_item(x): diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index c084fbda..faf00a41 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -9,7 +9,7 @@ from functools import wraps __author__ = 'dbr/Ben' __version__ = '2.0' -__api_version__ = '2.1.2' +__api_version__ = '2.2.0' import os import time @@ -580,19 +580,19 @@ class Tvdb: log().debug('Using proxy for URL: %s' % url) session.proxies = {'http': self.config['proxy'], 'https': self.config['proxy']} - session.headers.update({'Accept-Encoding': 'gzip,deflate', 'Authorization': 'Bearer %s' % self.get_token(), - 'Accept': 'application/vnd.thetvdb.v%s' % __api_version__}) + headers = {'Accept-Encoding': 'gzip,deflate', 'Authorization': 'Bearer %s' % self.get_token(), + 'Accept': 'application/vnd.thetvdb.v%s' % __api_version__} if None is not language and language in self.config['valid_languages']: - session.headers.update({'Accept-Language': language}) + headers.update({'Accept-Language': language}) resp = None if self._match_url_pattern('url_seriesInfo', url): self.show_not_found = False self.not_found = False try: - resp = getURL(url.strip(), params=params, session=session, json=True, raise_status_code=True, - raise_exceptions=True) + resp = getURL(url.strip(), params=params, session=session, headers=headers, json=True, + raise_status_code=True, raise_exceptions=True) except requests.exceptions.HTTPError as e: if 401 == e.response.status_code: # token expired, get new token, raise error to retry diff --git a/sickbeard/encodingKludge.py b/sickbeard/encodingKludge.py index 67067b20..ac362285 100644 --- a/sickbeard/encodingKludge.py +++ b/sickbeard/encodingKludge.py @@ -42,11 +42,16 @@ def fixStupidEncodings(x, silent=False): return None +def fixOutEncoding(x): + if isinstance(x, basestring): + return fixStupidEncodings(x) + return x + + def fixListEncodings(x): - if type(x) != list and type(x) != tuple: + if type(x) not in (list, tuple): return x - else: - return filter(lambda x: x != None, map(fixStupidEncodings, x)) + return filter(lambda i: None is not i, map(fixOutEncoding, x)) def callPeopleStupid(x): From bdfd57ad9cd8b0914f4e656d7feb811f605f1263 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Sat, 28 Jul 2018 14:12:00 +0100 Subject: [PATCH 2/2] Change TorrentDay. --- CHANGES.md | 8 +++++++- sickbeard/providers/torrentday.py | 14 +------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b8577215..190e5285 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,10 @@ -### 0.16.20 (2018-07-17 14:30:00 UTC) +### 0.16.21 (2018-07-28 14:15:00 UTC) + +* Change TorrentDay +* Change TVDB API 2 to version 2.2.0 + + +### 0.16.20 (2018-07-17 14:30:00 UTC) * Change TorrentDay * Fix for Emby updater when no folders are returned from API diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 71166a2b..c6a8fca1 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -30,19 +30,7 @@ class TorrentDayProvider(generic.TorrentProvider): generic.TorrentProvider.__init__(self, 'TorrentDay') self.url_home = ['https://%s/' % u for u in 'torrentday.eu', 'secure.torrentday.com', 'tdonline.org', - 'torrentday.it', 'www.td.af', 'www.torrentday.com'] + \ - ['http://td.%s/' % base64.b64decode(x) for x in [''.join(x) for x in [ - [re.sub('(?i)[I\s1]+', '', x[::-1]) for x in [ - 'y92d', 'zl12a', 'y9mY', 'n5 Wa', 'vNmIL', '=i1=Qb']], - [re.sub('(?i)[T\sq]+', '', x[::-1]) for x in [ - '15TWd', 'hV 3c', 'lBHb', 'vNncq', 'j5ib', '=qQ02b']], - [re.sub('(?i)[0\so]+', '', x[::-1]) for x in [ - 'Vmco', 'CZh', 'boi10', 'r92', '5yc', 'mcv', '=oc']], - [re.sub('(?i)[1\slq]+', '', x[::-1]) for x in [ - '2cql', 'yV1', 'mdlq', 'wQV', 'n11M', 'uA', '12Y', 't9']], - [re.sub('(?i)[\s1q]+', '', x[::-1]) for x in [ - 'Vmbq', 'WL10', 'ZyZ', 'rFW', '5yc', '12bj', 'q=0']] - ]]] + 'torrentday.it', 'www.td.af', 'www.torrentday.com'] self.url_vars = {'login': 'rss.php', 'search': 't?%s%s&qf=&q=%s'} self.url_tmpl = {'config_provider_home_uri': '%(home)s', 'login': '%(home)s%(vars)s',