diff --git a/gui/slick/interfaces/default/home_browseShows.tmpl b/gui/slick/interfaces/default/home_browseShows.tmpl index 2644c360..48a37175 100644 --- a/gui/slick/interfaces/default/home_browseShows.tmpl +++ b/gui/slick/interfaces/default/home_browseShows.tmpl @@ -631,7 +631,7 @@ $(function() { #end if
#if $use_ratings#
#slurp# + #end if##end if##if $use_votes#$this_show['votes'] $term_vote.lower()#end if##if $this_show.get('rank')##$this_show.get('rank') #end if##if $use_ratings#
#slurp# #else #end if##end if##if $use_votes#$this_show['votes'] $term_vote.lower()#end if##end if diff --git a/lib/api_tvdb/tvdb_api_v4.py b/lib/api_tvdb/tvdb_api_v4.py index 15a9c678..1bb4bbf1 100644 --- a/lib/api_tvdb/tvdb_api_v4.py +++ b/lib/api_tvdb/tvdb_api_v4.py @@ -272,7 +272,7 @@ class TvdbAPIv4(TVInfoBase): @staticmethod def _check_resp(type_chk=list, data=None): return isinstance(data, dict) and all(_k in data for _k in ('data', 'status')) \ - and 'success' == data['status'] and isinstance(data['data'], type_chk) + and 'success' == data['status'] and isinstance(data['data'], type_chk) and bool(data['data']) @staticmethod def _next_page(resp, page): @@ -1102,10 +1102,11 @@ class TvdbAPIv4(TVInfoBase): resp = self._get_show_data(ids[cur_tvinfo], cur_arg, direct_data=True) type_chk = dict else: + query = cur_arg % ids[cur_tvinfo] resp = self.get_cached_or_url( 'search?meta=translations', f's-v4-id-{cur_tvinfo}-{ids[cur_tvinfo]}', expire=self.search_cache_expire, - remote_id=(query := cur_arg % ids[cur_tvinfo]), query=query, type='series') + remote_id=query, query=query, type='series') if self._check_resp(type_chk, resp): if TVINFO_TVDB == cur_tvinfo: @@ -1121,21 +1122,19 @@ class TvdbAPIv4(TVInfoBase): except (BaseException, Exception): pass - if ids.get(TVINFO_TVDB_SLUG) and isinstance(ids.get(TVINFO_TVDB_SLUG), string_types): - if (resp := self.get_cached_or_url( + if ids.get(TVINFO_TVDB_SLUG) and isinstance(ids.get(TVINFO_TVDB_SLUG), string_types) \ + and self._check_resp(dict, resp := self.get_cached_or_url( f'/series/slug/{ids.get(TVINFO_TVDB_SLUG)}?meta=translations', - f's-id-{TVINFO_TVDB}-{ids[TVINFO_TVDB_SLUG]}', expire=self.search_cache_expire)) \ - and self._check_resp(dict, resp) \ - and ids.get(TVINFO_TVDB_SLUG).lower() == resp['data']['slug'].lower(): + f's-id-{TVINFO_TVDB}-{ids[TVINFO_TVDB_SLUG]}', expire=self.search_cache_expire)): + if ids.get(TVINFO_TVDB_SLUG).lower() == resp['data']['slug'].lower(): results.extend(_make_result_dict(resp['data'])) if name: for cur_name in ([name], name)[isinstance(name, list)]: - if (resp := self.get_cached_or_url( + if self._check_resp(list, resp := self.get_cached_or_url( 'search?meta=translations', f's-v4-name-{cur_name}', expire=self.search_cache_expire, - query=cur_name, type='series')) \ - and self._check_resp(list, resp): + query=cur_name, type='series')): for cur_item in resp['data']: results.extend(_make_result_dict(cur_item)) @@ -1159,8 +1158,7 @@ class TvdbAPIv4(TVInfoBase): result = [] page, cc = 0, 0 while 100 > page and cc < result_count: - if self._check_resp(list, resp := self._fetch_data('/series/filter', page=page, **kwargs)) \ - and len(resp['data']): + if self._check_resp(list, resp := self._fetch_data('/series/filter', page=page, **kwargs)): for cur_item in resp['data']: cc += 1 if cc > result_count: diff --git a/sickgear/webserve.py b/sickgear/webserve.py index a38b21da..0a01f096 100644 --- a/sickgear/webserve.py +++ b/sickgear/webserve.py @@ -6070,6 +6070,8 @@ class AddShows(Home): items = t.get_top_rated(year=top_year, in_last_year=1 == datetime.date.today().month and 7 > datetime.date.today().day) + ranking = dict((val, idx+1) for idx, val in + enumerate(sorted([cur_show_info.rating for cur_show_info in items], reverse=True))) oldest, newest, oldest_dt, newest_dt, dedupe = None, None, 9999999, 0, [] use_networks = False parseinfo = dateutil.parser.parserinfo(dayfirst=False, yearfirst=True) @@ -6108,14 +6110,14 @@ class AddShows(Home): ord_premiered=ord_premiered, str_premiered=str_premiered, started_past=started_past, - episode_overview=helpers.xhtml_escape(cur_show_info.overview[:250:]).strip('*').strip(), + episode_overview=self.clean_overview(cur_show_info), episode_season=cur_show_info.season, - genres=', '.join(cur_show_info.genre_list) - or (cur_show_info.genre and (cur_show_info.genre.strip('|').replace('|', ', ')) or ''), + genres=(', '.join(cur_show_info.genre_list) + or (cur_show_info.genre and (cur_show_info.genre.strip('|').replace('|', ', ')) or '') + ).lower(), ids=ids, images=images, - overview=(helpers.xhtml_escape(cur_show_info.overview[:250:]).strip('*').strip() - or 'No overview yet'), + overview=self.clean_overview(cur_show_info), title=cur_show_info.seriesname, language=language, language_img=sickgear.MEMCACHE_FLAG_IMAGES.get(language, False), @@ -6125,6 +6127,7 @@ class AddShows(Home): rating=False, url_src_db=base_url % cur_show_info.id, votes=cur_show_info.rating or 0, + rank=cur_show_info.rating and ranking.get(cur_show_info.rating) or 0, )) except (BaseException, Exception): pass