mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-02 17:33:37 +00:00
Merge branch 'hotfix/0.17.3'
This commit is contained in:
commit
6f6e76400d
5 changed files with 38 additions and 48 deletions
|
@ -1,4 +1,9 @@
|
|||
### 0.17.2 (2018-08-30 15:06:00 UTC)
|
||||
### 0.17.3 (2018-09-01 02:10:00 UTC)
|
||||
|
||||
* Fix issue with tvdb response data
|
||||
|
||||
|
||||
### 0.17.2 (2018-08-30 15:06:00 UTC)
|
||||
|
||||
* Fix Blutopia, Skytorrents, and SpeedCD torrent providers
|
||||
|
||||
|
|
|
@ -125,19 +125,6 @@ class TraktIndexer:
|
|||
def __repr__(self):
|
||||
return str(self.shows)
|
||||
|
||||
def _clean_data(self, data):
|
||||
"""Cleans up strings, lists, dicts returned
|
||||
|
||||
Issues corrected:
|
||||
- Replaces & with &
|
||||
- Trailing whitespace
|
||||
"""
|
||||
if isinstance(data, list):
|
||||
return [self._clean_data(d) for d in data]
|
||||
if isinstance(data, dict):
|
||||
return {k: self._clean_data(v) for k, v in data.iteritems()}
|
||||
return data if not isinstance(data, (str, unicode)) else data.strip().replace(u'&', u'&')
|
||||
|
||||
@staticmethod
|
||||
def _dict_prevent_none(d, key, default):
|
||||
v = None
|
||||
|
@ -156,12 +143,13 @@ class TraktIndexer:
|
|||
if None is not self.config['sleep_retry']:
|
||||
kwargs['sleep_retry'] = self.config['sleep_retry']
|
||||
try:
|
||||
from sickbeard.helpers import clean_data
|
||||
resp = TraktAPI().trakt_request(url, **kwargs)
|
||||
if len(resp):
|
||||
for d in resp:
|
||||
if isinstance(d, dict) and 'type' in d and d['type'] in self.config['result_types']:
|
||||
for k, v in d.iteritems():
|
||||
d[k] = self._clean_data(v)
|
||||
d[k] = clean_data(v)
|
||||
if 'show' in d and TraktResultTypes.show == d['type']:
|
||||
d.update(d['show'])
|
||||
del d['show']
|
||||
|
|
|
@ -22,7 +22,7 @@ import requests.exceptions
|
|||
import datetime
|
||||
import re
|
||||
|
||||
from sickbeard.helpers import getURL, tryInt
|
||||
from sickbeard.helpers import getURL, tryInt, clean_data
|
||||
import sickbeard
|
||||
|
||||
from lib.dateutil.parser import parse
|
||||
|
@ -625,13 +625,13 @@ class Tvdb:
|
|||
v = self.config['url_artworkPrefix'] % v
|
||||
elif 'genre' == k:
|
||||
keep_data['genre_list'] = v
|
||||
v = '|%s|' % '|'.join([self._clean_data(c) for c in v if isinstance(c, basestring)])
|
||||
v = '|%s|' % '|'.join([clean_data(c) for c in v if isinstance(c, basestring)])
|
||||
elif 'gueststars' == k:
|
||||
keep_data['gueststars_list'] = v
|
||||
v = '|%s|' % '|'.join([self._clean_data(c) for c in v if isinstance(c, basestring)])
|
||||
v = '|%s|' % '|'.join([clean_data(c) for c in v if isinstance(c, basestring)])
|
||||
elif 'writers' == k:
|
||||
keep_data[k] = v
|
||||
v = '|%s|' % '|'.join([self._clean_data(c) for c in v if isinstance(c, basestring)])
|
||||
v = '|%s|' % '|'.join([clean_data(c) for c in v if isinstance(c, basestring)])
|
||||
elif 'firstaired' == k:
|
||||
if v:
|
||||
try:
|
||||
|
@ -643,11 +643,11 @@ class Tvdb:
|
|||
elif 'imdbid' == k:
|
||||
if v:
|
||||
if re.search(r'^(tt)?\d{1,7}$', v, flags=re.I):
|
||||
v = self._clean_data(v)
|
||||
v = clean_data(v)
|
||||
else:
|
||||
v = ''
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
v = clean_data(v)
|
||||
if k in map_show:
|
||||
k = map_show[k]
|
||||
if k_org is not k:
|
||||
|
@ -726,19 +726,6 @@ class Tvdb:
|
|||
else:
|
||||
self.shows[sid].data[key] = value
|
||||
|
||||
def _clean_data(self, data):
|
||||
"""Cleans up strings, lists, dicts returned
|
||||
|
||||
Issues corrected:
|
||||
- Replaces & with &
|
||||
- Trailing whitespace
|
||||
"""
|
||||
if isinstance(data, list):
|
||||
return [self._clean_data(d) for d in data]
|
||||
if isinstance(data, dict):
|
||||
return {k: self._clean_data(v) for k, v in data.iteritems()}
|
||||
return data if not isinstance(data, (str, unicode)) else data.strip().replace(u'&', u'&')
|
||||
|
||||
def search(self, series):
|
||||
"""This searches TheTVDB.com for the series name
|
||||
and returns the result list
|
||||
|
@ -864,7 +851,7 @@ class Tvdb:
|
|||
if 'filename' == k and v:
|
||||
v = self.config['url_artworkPrefix'] % v
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
v = clean_data(v)
|
||||
data[k] = v
|
||||
|
||||
return data
|
||||
|
@ -988,7 +975,7 @@ class Tvdb:
|
|||
if 'filename' == k:
|
||||
v = self.config['url_artworkPrefix'] % v
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
v = clean_data(v)
|
||||
|
||||
if k in ep_map_keys:
|
||||
k = ep_map_keys[k]
|
||||
|
|
|
@ -36,6 +36,7 @@ from tvdb_exceptions import (tvdb_error_v1, tvdb_shownotfound_v1,
|
|||
tvdb_seasonnotfound_v1, tvdb_episodenotfound_v1, tvdb_attributenotfound_v1)
|
||||
|
||||
from sickbeard import logger
|
||||
from sickbeard.helpers import clean_data
|
||||
|
||||
|
||||
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logr=None):
|
||||
|
@ -629,16 +630,6 @@ class TvdbV1:
|
|||
self.shows[sid] = Show()
|
||||
self.shows[sid].data[key] = value
|
||||
|
||||
@staticmethod
|
||||
def _clean_data(data):
|
||||
"""Cleans up strings returned by TheTVDB.com
|
||||
|
||||
Issues corrected:
|
||||
- Replaces & with &
|
||||
- Trailing whitespace
|
||||
"""
|
||||
return data if not isinstance(data, basestring) else data.strip().replace(u'&', u'&')
|
||||
|
||||
def _get_url_artwork(self, image):
|
||||
return image and (self.config['url_artworkPrefix'] % image) or image
|
||||
|
||||
|
@ -823,7 +814,7 @@ class TvdbV1:
|
|||
if k in ['banner', 'fanart', 'poster']:
|
||||
v = self._get_url_artwork(v)
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
v = self.clean_data(v)
|
||||
|
||||
self._set_show_data(sid, k.lower(), v)
|
||||
|
||||
|
@ -878,7 +869,7 @@ class TvdbV1:
|
|||
if 'filename' == k:
|
||||
v = self._get_url_artwork(v)
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
v = self.clean_data(v)
|
||||
|
||||
self._set_item(sid, seas_no, ep_no, k, v)
|
||||
|
||||
|
|
|
@ -1778,3 +1778,22 @@ def write_file(filepath, data, raw=False, xmltree=False, utf8=False, raise_excep
|
|||
raise e
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def clean_data(data):
|
||||
"""Cleans up strings, lists, dicts returned
|
||||
|
||||
Issues corrected:
|
||||
- Replaces & with &
|
||||
- Trailing whitespace
|
||||
- Decode html entities
|
||||
"""
|
||||
|
||||
if isinstance(data, list):
|
||||
return [clean_data(d) for d in data]
|
||||
if isinstance(data, dict):
|
||||
return {k: clean_data(v) for k, v in data.iteritems()}
|
||||
if isinstance(data, basestring):
|
||||
from lib.six.moves.html_parser import HTMLParser
|
||||
return HTMLParser().unescape(data).strip().replace(u'&', u'&')
|
||||
return data
|
||||
|
|
Loading…
Reference in a new issue