Merge branch 'hotfix/3.32.3'

This commit is contained in:
JackDandy 2024-06-26 18:25:47 +01:00
commit d5c0fa3c07
4 changed files with 23 additions and 9 deletions

View file

@ -1,4 +1,11 @@
### 3.32.2 (2024-06-26 07:20:00 UTC) ### 3.32.3 (2024-06-26 18:10:00 UTC)
* Fix votes on shows/IMDb cards
* Fix ratings on shows/TMDB cards
* Fix TVmaze parser
### 3.32.2 (2024-06-26 07:20:00 UTC)
* Fix systemd linefeed typo * Fix systemd linefeed typo

View file

@ -473,6 +473,7 @@ class TmdbIndexer(TVInfoBase):
ti_show.popularity = show_dict.get('popularity') ti_show.popularity = show_dict.get('popularity')
ti_show.vote_count = show_dict.get('vote_count') ti_show.vote_count = show_dict.get('vote_count')
ti_show.vote_average = show_dict.get('vote_average') ti_show.vote_average = show_dict.get('vote_average')
ti_show.rating = ti_show.vote_average
ti_show.origin_countries = show_dict.get('origin_country') or [] ti_show.origin_countries = show_dict.get('origin_country') or []
ti_show.genre_list = [] ti_show.genre_list = []
ti_show.origin_countries = clean_data(show_dict.get('origin_country') or []) ti_show.origin_countries = clean_data(show_dict.get('origin_country') or [])

View file

@ -372,7 +372,8 @@ class TvMaze(TVInfoBase):
log.error('error episodes have no numbers') log.error('error episodes have no numbers')
ti_season = ti_season or ti_show[cur_season.season_number] # type: TVInfoSeason ti_season = ti_season or ti_show[cur_season.season_number] # type: TVInfoSeason
for k, v in iteritems(season_map): for k, v in iteritems(season_map):
setattr(ti_season, k, clean_data(getattr(cur_season, v, None)) or empty_se.get(v)) if k not in ('network', ) and k in season_map:
setattr(ti_season, k, clean_data(getattr(cur_season, v, None)) or empty_se.get(v))
if cur_season.network: if cur_season.network:
self._set_network(ti_season, cur_season.network, False) self._set_network(ti_season, cur_season.network, False)
elif cur_season.web_channel: elif cur_season.web_channel:
@ -558,7 +559,7 @@ class TvMaze(TVInfoBase):
_s_o = TVInfoShow() _s_o = TVInfoShow()
show_dict = _s_o.__dict__ show_dict = _s_o.__dict__
for k, v in iteritems(show_dict): for k, v in iteritems(show_dict):
if k not in ('cast', 'crew', 'images', 'aliases', 'rating'): if k not in ('cast', 'crew', 'images', 'aliases', 'rating', 'network') and k in show_map:
show_dict[k] = getattr(_s_d, show_map.get(k, k), clean_data(show_dict[k])) show_dict[k] = getattr(_s_d, show_map.get(k, k), clean_data(show_dict[k]))
_s_o.aliases = [clean_data(a.name) for a in _s_d.akas] _s_o.aliases = [clean_data(a.name) for a in _s_d.akas]
_s_o.runtime = _s_d.average_runtime or _s_d.runtime _s_o.runtime = _s_d.average_runtime or _s_d.runtime

View file

@ -4822,14 +4822,19 @@ class AddShows(Home):
ord_premiered, str_premiered, started_past, oldest_dt, newest_dt, oldest, newest, _, _, _, _ \ ord_premiered, str_premiered, started_past, oldest_dt, newest_dt, oldest, newest, _, _, _, _ \
= self.sanitise_dates('01-01-%s' % year, oldest_dt, newest_dt, oldest, newest) = self.sanitise_dates('01-01-%s' % year, oldest_dt, newest_dt, oldest, newest)
genres = row.select('.genre')
images = {} images = {}
img = row.select('img.ipc-image') img = row.select('img.ipc-image')
overview = self.parse_imdb_overview(row) overview = self.parse_imdb_overview(row)
rating = row.select_one('.ipc-rating-star').get_text() rating = row.select_one('.ipc-rating-star').get_text()
rating = rating and rating.split()[0] or '' rating = rating and rating.split()[0] or ''
voting = row('span', text=re.compile(r'(?i)vote')) try:
voting = voting and re.sub(r'\D', '', voting[0].find_parent('div').get_text()) or '' voting = row.select_one('.ipc-rating-star--voteCount').get_text(strip=True).strip('()').lower()
if voting.endswith('k'):
voting = helpers.try_float(voting[:-1]) * 1000
elif voting.endswith('m'):
voting = helpers.try_float(voting[:-1]) * 1000000
except (BaseException, Exception):
voting = ''
img_uri = None img_uri = None
if len(img): if len(img):
img_uri = img[0].get('src') img_uri = img[0].get('src')
@ -4859,7 +4864,7 @@ class AddShows(Home):
rating=0 if not len(rating) else int(helpers.try_float(rating) * 10), rating=0 if not len(rating) else int(helpers.try_float(rating) * 10),
title=title, title=title,
url_src_db='https://www.imdb.com/%s/' % url_path.strip('/'), url_src_db='https://www.imdb.com/%s/' % url_path.strip('/'),
votes=0 if not len(voting) else helpers.try_int(voting, 'TBA'))) votes=helpers.try_int(voting, 'TBA')))
show_obj = helpers.find_show_by_id({TVINFO_IMDB: int(ids['imdb'].replace('tt', ''))}, show_obj = helpers.find_show_by_id({TVINFO_IMDB: int(ids['imdb'].replace('tt', ''))},
no_mapped_ids=False) no_mapped_ids=False)
@ -5479,8 +5484,8 @@ class AddShows(Home):
country_img=sickgear.MEMCACHE_FLAG_IMAGES.get(cc.lower(), False), country_img=sickgear.MEMCACHE_FLAG_IMAGES.get(cc.lower(), False),
network=network_name, network=network_name,
url_src_db=base_url % cur_show_info.id, url_src_db=base_url % cur_show_info.id,
rating=0 < (cur_show_info.rating or 0) and rating=0 < (cur_show_info.vote_average or 0) and
('%.2f' % (cur_show_info.rating * 10)).replace('.00', '') or 0, ('%.2f' % (cur_show_info.vote_average * 10)).replace('.00', '') or 0,
votes=('%.2f' % cur_show_info.popularity) or 0, votes=('%.2f' % cur_show_info.popularity) or 0,
)) ))
if p_ref: if p_ref: