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):