mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-22 18:53:38 +00:00
Merge branch 'main' into dev
This commit is contained in:
commit
8656c087cd
8 changed files with 51 additions and 24 deletions
|
@ -5,6 +5,12 @@
|
||||||
* Change requirements for pure py3
|
* Change requirements for pure py3
|
||||||
|
|
||||||
|
|
||||||
|
### 3.27.6 (2023-02-18 20:10:00 UTC)
|
||||||
|
|
||||||
|
* Fix show view edit language
|
||||||
|
* Fix TVDb image parsing
|
||||||
|
|
||||||
|
|
||||||
### 3.27.5 (2023-02-16 18:30:00 UTC)
|
### 3.27.5 (2023-02-16 18:30:00 UTC)
|
||||||
|
|
||||||
* Fix network for persons
|
* Fix network for persons
|
||||||
|
|
|
@ -604,7 +604,7 @@ class TmdbIndexer(TVInfoBase):
|
||||||
# type: (integer_types, AnyStr, bool, bool, bool, bool, bool, bool, bool, Optional[Any]) -> bool
|
# type: (integer_types, AnyStr, bool, bool, bool, bool, bool, bool, bool, Optional[Any]) -> bool
|
||||||
# note: this is only working for images fetching currently
|
# note: this is only working for images fetching currently
|
||||||
self.show_not_found = False
|
self.show_not_found = False
|
||||||
to_append = ['external_ids', 'alternative_titles', 'content_ratings']
|
to_append = ['external_ids', 'alternative_titles', 'content_ratings', 'translations']
|
||||||
tmdb_lang = ('en-US', language)[language in self._tmdb_supported_lang_list]
|
tmdb_lang = ('en-US', language)[language in self._tmdb_supported_lang_list]
|
||||||
if any((banners, posters, seasons, seasonwides, fanart)):
|
if any((banners, posters, seasons, seasonwides, fanart)):
|
||||||
to_append.append('images')
|
to_append.append('images')
|
||||||
|
@ -615,7 +615,7 @@ class TmdbIndexer(TVInfoBase):
|
||||||
try:
|
try:
|
||||||
tmdb = tmdbsimple.TV(sid)
|
tmdb = tmdbsimple.TV(sid)
|
||||||
show_data = tmdb.info(append_to_response=','.join(to_append), language=tmdb_lang)
|
show_data = tmdb.info(append_to_response=','.join(to_append), language=tmdb_lang)
|
||||||
if tmdb_lang not in show_data.get('languages'):
|
if tmdb_lang not in (_l['iso_639_1'] for _l in show_data['translations'].get('translations', []) or []):
|
||||||
tmdb_lang = 'en'
|
tmdb_lang = 'en'
|
||||||
show_data = tmdb.info(append_to_response=','.join(to_append), language=tmdb_lang)
|
show_data = tmdb.info(append_to_response=','.join(to_append), language=tmdb_lang)
|
||||||
except (BaseException, Exception):
|
except (BaseException, Exception):
|
||||||
|
|
|
@ -141,6 +141,8 @@ class Tvdb(TVInfoBase):
|
||||||
>> t['Scrubs'][1][24]['episodename']
|
>> t['Scrubs'][1][24]['episodename']
|
||||||
u'My Last Day'
|
u'My Last Day'
|
||||||
"""
|
"""
|
||||||
|
map_languages = {}
|
||||||
|
reverse_map_languages = {v: k for k, v in iteritems(map_languages)}
|
||||||
supported_id_searches = [TVINFO_TVDB, TVINFO_TVDB_SLUG]
|
supported_id_searches = [TVINFO_TVDB, TVINFO_TVDB_SLUG]
|
||||||
|
|
||||||
# noinspection PyUnusedLocal
|
# noinspection PyUnusedLocal
|
||||||
|
@ -839,10 +841,10 @@ class Tvdb(TVInfoBase):
|
||||||
k, v = k.lower(), v.lower() if isinstance(v, string_types) else v
|
k, v = k.lower(), v.lower() if isinstance(v, string_types) else v
|
||||||
if 'filename' == k:
|
if 'filename' == k:
|
||||||
k = 'bannerpath'
|
k = 'bannerpath'
|
||||||
v = self.config['url_artworks'] % v
|
v = self._make_image(self.config['url_artworks'], v)
|
||||||
elif 'thumbnail' == k:
|
elif 'thumbnail' == k:
|
||||||
k = 'thumbnailpath'
|
k = 'thumbnailpath'
|
||||||
v = self.config['url_artworks'] % v
|
v = self._make_image(self.config['url_artworks'], v)
|
||||||
elif 'keytype' == k:
|
elif 'keytype' == k:
|
||||||
k = 'bannertype'
|
k = 'bannertype'
|
||||||
banners.setdefault(btype, OrderedDict()).setdefault(btype2, OrderedDict()).setdefault(bid, {})[
|
banners.setdefault(btype, OrderedDict()).setdefault(btype2, OrderedDict()).setdefault(bid, {})[
|
||||||
|
@ -853,6 +855,13 @@ class Tvdb(TVInfoBase):
|
||||||
|
|
||||||
self._set_show_data(sid, '_banners', banners, add=True)
|
self._set_show_data(sid, '_banners', banners, add=True)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _make_image(base_url, url):
|
||||||
|
# type: (str, str) -> str
|
||||||
|
if not url or url.lower().startswith('http'):
|
||||||
|
return url or ''
|
||||||
|
return base_url % url
|
||||||
|
|
||||||
def _parse_actors(self, sid, actor_list, actor_list_alt):
|
def _parse_actors(self, sid, actor_list, actor_list_alt):
|
||||||
|
|
||||||
a = []
|
a = []
|
||||||
|
@ -937,7 +946,7 @@ class Tvdb(TVInfoBase):
|
||||||
role_image = (alts.get(n['id'], {}).get('image'), n.get('image'))[
|
role_image = (alts.get(n['id'], {}).get('image'), n.get('image'))[
|
||||||
any([n.get('image')]) and 1 == c_p_list.count((n['name'], n['role']))]
|
any([n.get('image')]) and 1 == c_p_list.count((n['name'], n['role']))]
|
||||||
if role_image:
|
if role_image:
|
||||||
role_image = self.config['url_artworks'] % role_image
|
role_image = self._make_image(self.config['url_artworks'], role_image)
|
||||||
character_name = n.get('role', '').strip() or alts.get(n['id'], {}).get('role', '')
|
character_name = n.get('role', '').strip() or alts.get(n['id'], {}).get('role', '')
|
||||||
person_name = n.get('name', '').strip() or alts.get(n['id'], {}).get('name', '')
|
person_name = n.get('name', '').strip() or alts.get(n['id'], {}).get('name', '')
|
||||||
try:
|
try:
|
||||||
|
@ -986,7 +995,7 @@ class Tvdb(TVInfoBase):
|
||||||
|
|
||||||
if None is not v:
|
if None is not v:
|
||||||
if 'filename' == k and v:
|
if 'filename' == k and v:
|
||||||
v = self.config['url_artworks'] % v
|
v = self._make_image(self.config['url_artworks'], v)
|
||||||
else:
|
else:
|
||||||
v = clean_data(v)
|
v = clean_data(v)
|
||||||
data[k] = v
|
data[k] = v
|
||||||
|
@ -1004,8 +1013,8 @@ class Tvdb(TVInfoBase):
|
||||||
image_data['data'] = sorted(image_data['data'], reverse=True,
|
image_data['data'] = sorted(image_data['data'], reverse=True,
|
||||||
key=lambda x: (x['ratingsinfo']['average'], x['ratingsinfo']['count']))
|
key=lambda x: (x['ratingsinfo']['average'], x['ratingsinfo']['count']))
|
||||||
if not excluded_main_data:
|
if not excluded_main_data:
|
||||||
url_image = self.config['url_artworks'] % image_data['data'][0]['filename']
|
url_image = self._make_image(self.config['url_artworks'], image_data['data'][0]['filename'])
|
||||||
url_thumb = self.config['url_artworks'] % image_data['data'][0]['thumbnail']
|
url_thumb = self._make_image(self.config['url_artworks'], image_data['data'][0]['thumbnail'])
|
||||||
self._set_show_data(sid, image_type, url_image)
|
self._set_show_data(sid, image_type, url_image)
|
||||||
self._set_show_data(sid, u'%s_thumb' % image_type, url_thumb)
|
self._set_show_data(sid, u'%s_thumb' % image_type, url_thumb)
|
||||||
excluded_main_data = True # artwork found so prevent fallback
|
excluded_main_data = True # artwork found so prevent fallback
|
||||||
|
@ -1037,7 +1046,7 @@ class Tvdb(TVInfoBase):
|
||||||
|
|
||||||
# Parse show information
|
# Parse show information
|
||||||
url = self.config['url_series_info'] % sid
|
url = self.config['url_series_info'] % sid
|
||||||
if direct_data or sid not in self.shows or None is self.shows[sid].id:
|
if direct_data or sid not in self.shows or None is self.shows[sid].id or language != self.shows[sid].language:
|
||||||
log.debug('Getting all series data for %s' % sid)
|
log.debug('Getting all series data for %s' % sid)
|
||||||
show_data = self._getetsrc(url, language=language)
|
show_data = self._getetsrc(url, language=language)
|
||||||
if not show_data or not show_data.get('data'):
|
if not show_data or not show_data.get('data'):
|
||||||
|
@ -1200,7 +1209,7 @@ class Tvdb(TVInfoBase):
|
||||||
if None is not v:
|
if None is not v:
|
||||||
if 'filename' == k and v:
|
if 'filename' == k and v:
|
||||||
if '://' not in v:
|
if '://' not in v:
|
||||||
v = self.config['url_artworks'] % v
|
v = self._make_image(self.config['url_artworks'], v)
|
||||||
else:
|
else:
|
||||||
v = clean_data(v)
|
v = clean_data(v)
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,7 @@ class TVInfoShow(dict):
|
||||||
self.vote_count = None # type: Optional[integer_types]
|
self.vote_count = None # type: Optional[integer_types]
|
||||||
self.vote_average = None # type: Optional[Union[integer_types, float]]
|
self.vote_average = None # type: Optional[Union[integer_types, float]]
|
||||||
self.origin_countries = [] # type: List[AnyStr]
|
self.origin_countries = [] # type: List[AnyStr]
|
||||||
|
self.requested_language = '' # type: AnyStr
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
nr_seasons = len(self)
|
nr_seasons = len(self)
|
||||||
|
@ -905,8 +906,8 @@ class TVInfoBase(object):
|
||||||
'cache_search': kwargs.get('cache_search'),
|
'cache_search': kwargs.get('cache_search'),
|
||||||
} # type: Dict[AnyStr, Any]
|
} # type: Dict[AnyStr, Any]
|
||||||
|
|
||||||
def _must_load_data(self, sid, load_episodes, banners, posters, seasons, seasonwides, fanart, actors):
|
def _must_load_data(self, sid, load_episodes, banners, posters, seasons, seasonwides, fanart, actors, lang):
|
||||||
# type: (integer_types, bool, bool, bool, bool, bool, bool, bool) -> bool
|
# type: (integer_types, bool, bool, bool, bool, bool, bool, bool, str) -> bool
|
||||||
"""
|
"""
|
||||||
returns if show data has to be fetched for (extra) data (episodes, images, ...)
|
returns if show data has to be fetched for (extra) data (episodes, images, ...)
|
||||||
or can taken from self.shows cache
|
or can taken from self.shows cache
|
||||||
|
@ -918,10 +919,16 @@ class TVInfoBase(object):
|
||||||
:param seasonwides: should load season wide images
|
:param seasonwides: should load season wide images
|
||||||
:param fanart: should load fanart
|
:param fanart: should load fanart
|
||||||
:param actors: should load actors
|
:param actors: should load actors
|
||||||
|
:param lang: requested language
|
||||||
"""
|
"""
|
||||||
if sid not in self.shows or None is self.shows[sid].id or \
|
if sid not in self.shows or None is self.shows[sid].id or \
|
||||||
(load_episodes and not getattr(self.shows[sid], 'ep_loaded', False)):
|
(load_episodes and not getattr(self.shows[sid], 'ep_loaded', False)):
|
||||||
return True
|
return True
|
||||||
|
_show = self.shows[sid] # type: TVInfoShow
|
||||||
|
if _show.requested_language != lang:
|
||||||
|
_show.ep_loaded = _show.poster_loaded = _show.banner_loaded = _show.actors_loaded = _show.fanart_loaded = \
|
||||||
|
_show.seasonwide_images_loaded = _show.season_images_loaded = False
|
||||||
|
return True
|
||||||
for data_type, en_type, p_type in [(u'poster', 'posters_enabled', posters),
|
for data_type, en_type, p_type in [(u'poster', 'posters_enabled', posters),
|
||||||
(u'banner', 'banners_enabled', banners),
|
(u'banner', 'banners_enabled', banners),
|
||||||
(u'fanart', 'fanart_enabled', fanart),
|
(u'fanart', 'fanart_enabled', fanart),
|
||||||
|
@ -929,7 +936,7 @@ class TVInfoBase(object):
|
||||||
(u'seasonwide', 'seasonwides_enabled', seasonwides),
|
(u'seasonwide', 'seasonwides_enabled', seasonwides),
|
||||||
(u'actors', 'actors_enabled', actors)]:
|
(u'actors', 'actors_enabled', actors)]:
|
||||||
if (p_type or self.config.get(en_type, False)) and \
|
if (p_type or self.config.get(en_type, False)) and \
|
||||||
not getattr(self.shows[sid], '%s_loaded' % data_type, False):
|
not getattr(_show, '%s_loaded' % data_type, False):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1102,7 +1109,8 @@ class TVInfoBase(object):
|
||||||
self.shows.lock.release()
|
self.shows.lock.release()
|
||||||
try:
|
try:
|
||||||
if self._must_load_data(show_id, load_episodes, banners, posters, seasons, seasonwides, fanart,
|
if self._must_load_data(show_id, load_episodes, banners, posters, seasons, seasonwides, fanart,
|
||||||
actors):
|
actors, self.config['language']):
|
||||||
|
self.shows[show_id].requested_language = self.config['language']
|
||||||
self._get_show_data(show_id, self.map_languages.get(self.config['language'],
|
self._get_show_data(show_id, self.map_languages.get(self.config['language'],
|
||||||
self.config['language']),
|
self.config['language']),
|
||||||
load_episodes, banners, posters, seasons, seasonwides, fanart, actors)
|
load_episodes, banners, posters, seasons, seasonwides, fanart, actors)
|
||||||
|
|
|
@ -868,7 +868,7 @@ class GenericMetadata(object):
|
||||||
|
|
||||||
t = sickgear.TVInfoAPI(tv_id).setup(**tvinfo_config)
|
t = sickgear.TVInfoAPI(tv_id).setup(**tvinfo_config)
|
||||||
return t.get_show((show_obj.ids[tv_id]['id'], show_obj.prodid)[tv_src == show_obj.tvid],
|
return t.get_show((show_obj.ids[tv_id]['id'], show_obj.prodid)[tv_src == show_obj.tvid],
|
||||||
load_episodes=False, banners=True, posters=True, fanart=True)
|
load_episodes=False, banners=True, posters=True, fanart=True, language=show_obj.lang)
|
||||||
except (BaseTVinfoError, IOError) as e:
|
except (BaseTVinfoError, IOError) as e:
|
||||||
logger.log(u"Unable to look up show on " + sickgear.TVInfoAPI(
|
logger.log(u"Unable to look up show on " + sickgear.TVInfoAPI(
|
||||||
tv_id).name + ", not downloading images: " + ex(e), logger.WARNING)
|
tv_id).name + ", not downloading images: " + ex(e), logger.WARNING)
|
||||||
|
|
|
@ -979,7 +979,7 @@ class QueueItemAdd(ShowQueueItem):
|
||||||
logger.log(u'' + str(sickgear.TVInfoAPI(self.tvid).name) + ': ' + repr(tvinfo_config))
|
logger.log(u'' + str(sickgear.TVInfoAPI(self.tvid).name) + ': ' + repr(tvinfo_config))
|
||||||
|
|
||||||
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
||||||
s = t.get_show(self.prodid, load_episodes=False)
|
s = t.get_show(self.prodid, load_episodes=False, language=self.lang)
|
||||||
|
|
||||||
if getattr(t, 'show_not_found', False):
|
if getattr(t, 'show_not_found', False):
|
||||||
logger.log('Show %s was not found on %s, maybe show was deleted' %
|
logger.log('Show %s was not found on %s, maybe show was deleted' %
|
||||||
|
@ -1693,7 +1693,7 @@ class QueueItemSwitchSource(ShowQueueItem):
|
||||||
if new_prodid != self.show_obj.ids.get(self.new_tvid, {}).get('id') is not None:
|
if new_prodid != self.show_obj.ids.get(self.new_tvid, {}).get('id') is not None:
|
||||||
new_prodid = self.show_obj.ids.get(self.new_tvid, {}).get('id')
|
new_prodid = self.show_obj.ids.get(self.new_tvid, {}).get('id')
|
||||||
try:
|
try:
|
||||||
td = t.get_show(show_id=new_prodid, actors=True)
|
td = t.get_show(show_id=new_prodid, actors=True, language=self.show_obj.lang)
|
||||||
except (BaseException, Exception):
|
except (BaseException, Exception):
|
||||||
td = None
|
td = None
|
||||||
logger.log('Failed to get new tv show id (%s) from source %s' %
|
logger.log('Failed to get new tv show id (%s) from source %s' %
|
||||||
|
|
|
@ -2232,7 +2232,7 @@ class TVShow(TVShowBase):
|
||||||
|
|
||||||
cached_show = None
|
cached_show = None
|
||||||
try:
|
try:
|
||||||
cached_show = t.get_show(self.prodid)
|
cached_show = t.get_show(self.prodid, language=self._lang)
|
||||||
except BaseTVinfoError as e:
|
except BaseTVinfoError as e:
|
||||||
logger.log('Unable to find cached seasons from %s: %s' % (
|
logger.log('Unable to find cached seasons from %s: %s' % (
|
||||||
sickgear.TVInfoAPI(self.tvid).name, ex(e)), logger.WARNING)
|
sickgear.TVInfoAPI(self.tvid).name, ex(e)), logger.WARNING)
|
||||||
|
@ -2332,7 +2332,7 @@ class TVShow(TVShowBase):
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
||||||
show_obj = t.get_show(self.prodid)
|
show_obj = t.get_show(self.prodid, language=self._lang)
|
||||||
except BaseTVinfoError:
|
except BaseTVinfoError:
|
||||||
logger.log('%s timed out, unable to update episodes for [%s] from %s' %
|
logger.log('%s timed out, unable to update episodes for [%s] from %s' %
|
||||||
(sickgear.TVInfoAPI(self.tvid).name, self._name, sickgear.TVInfoAPI(self.tvid).name),
|
(sickgear.TVInfoAPI(self.tvid).name, self._name, sickgear.TVInfoAPI(self.tvid).name),
|
||||||
|
@ -2596,7 +2596,7 @@ class TVShow(TVShowBase):
|
||||||
if self._lang:
|
if self._lang:
|
||||||
tvinfo_config['language'] = self._lang
|
tvinfo_config['language'] = self._lang
|
||||||
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
||||||
cached_show = t.get_show(self.prodid, load_episodes=False)
|
cached_show = t.get_show(self.prodid, load_episodes=False, language=self._lang)
|
||||||
vals = (self.prodid, '' if not cached_show else ' [%s]' % cached_show['seriesname'].strip())
|
vals = (self.prodid, '' if not cached_show else ' [%s]' % cached_show['seriesname'].strip())
|
||||||
if len(sql_result):
|
if len(sql_result):
|
||||||
logger.log('%s: Loading show info%s from database' % vals)
|
logger.log('%s: Loading show info%s from database' % vals)
|
||||||
|
@ -2791,7 +2791,7 @@ class TVShow(TVShowBase):
|
||||||
if getattr(tvinfo_data, 'id', None) == self.prodid:
|
if getattr(tvinfo_data, 'id', None) == self.prodid:
|
||||||
show_info = tvinfo_data
|
show_info = tvinfo_data
|
||||||
else:
|
else:
|
||||||
show_info = t.get_show(self.prodid, actors=True) # type: Optional[TVInfoShow]
|
show_info = t.get_show(self.prodid, actors=True, language=self._lang) # type: Optional[TVInfoShow]
|
||||||
if None is show_info or getattr(t, 'show_not_found', False):
|
if None is show_info or getattr(t, 'show_not_found', False):
|
||||||
if getattr(t, 'show_not_found', False):
|
if getattr(t, 'show_not_found', False):
|
||||||
self.inc_not_found_count()
|
self.inc_not_found_count()
|
||||||
|
@ -2888,7 +2888,8 @@ class TVShow(TVShowBase):
|
||||||
if not show_info_cast:
|
if not show_info_cast:
|
||||||
tvinfo_config = sickgear.TVInfoAPI(self.tvid).api_params.copy()
|
tvinfo_config = sickgear.TVInfoAPI(self.tvid).api_params.copy()
|
||||||
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
||||||
show_info = t.get_show(self.prodid, load_episodes=False, actors=True) # type: Optional[TVInfoShow]
|
show_info = t.get_show(self.prodid, load_episodes=False, actors=True,
|
||||||
|
language=self._lang) # type: Optional[TVInfoShow]
|
||||||
if None is show_info:
|
if None is show_info:
|
||||||
return
|
return
|
||||||
show_info_cast = show_info.cast
|
show_info_cast = show_info.cast
|
||||||
|
@ -4281,7 +4282,8 @@ class TVEpisode(TVEpisodeBase):
|
||||||
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
t = sickgear.TVInfoAPI(self.tvid).setup(**tvinfo_config)
|
||||||
else:
|
else:
|
||||||
t = tvapi
|
t = tvapi
|
||||||
ep_info = t.get_show(self._show_obj.prodid)[season][episode] # type: TVInfoEpisode
|
ep_info = t.get_show(self._show_obj.prodid,
|
||||||
|
language=self.show_obj.lang)[season][episode] # type: TVInfoEpisode
|
||||||
else:
|
else:
|
||||||
ep_info = cached_season[episode] # type: TVInfoEpisode
|
ep_info = cached_season[episode] # type: TVInfoEpisode
|
||||||
|
|
||||||
|
|
|
@ -2789,7 +2789,9 @@ class Home(MainHandler):
|
||||||
del sickgear.FANART_RATINGS[tvid_prodid]
|
del sickgear.FANART_RATINGS[tvid_prodid]
|
||||||
sickgear.save_config()
|
sickgear.save_config()
|
||||||
|
|
||||||
if tvinfo_lang and tvinfo_lang in sickgear.TVInfoAPI(show_obj.tvid).setup().config['valid_languages']:
|
t = sickgear.TVInfoAPI(show_obj.tvid).setup()
|
||||||
|
if tvinfo_lang and (tvinfo_lang in t.config['valid_languages'] or
|
||||||
|
tvinfo_lang in (_l.get('sg_lang') for _l in t.get_languages() or [])):
|
||||||
infosrc_lang = tvinfo_lang
|
infosrc_lang = tvinfo_lang
|
||||||
else:
|
else:
|
||||||
infosrc_lang = show_obj.lang
|
infosrc_lang = show_obj.lang
|
||||||
|
|
Loading…
Reference in a new issue