diff --git a/CHANGES.md b/CHANGES.md index 97eb5e7..47ac73f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -91,6 +91,7 @@ * Fix new unique_name in templates * Fix genre field in tvmaze_api * Change api interface folders to api_* to fix legacy tmdb_api folder cleanup on new installs +* Fix TVmaze genres property to be lowercase string ### 0.24.15 (2021-08-05 11:45:00 UTC) diff --git a/lib/api_tvmaze/tvmaze_api.py b/lib/api_tvmaze/tvmaze_api.py index ad1865e..55e0063 100644 --- a/lib/api_tvmaze/tvmaze_api.py +++ b/lib/api_tvmaze/tvmaze_api.py @@ -14,7 +14,7 @@ import requests from urllib3.util.retry import Retry from requests.adapters import HTTPAdapter -from six import integer_types, iteritems +from six import integer_types, iteritems, string_types from sg_helpers import get_url, try_int from lib.dateutil.parser import parser # noinspection PyProtectedMember @@ -143,7 +143,8 @@ class TvMaze(TVInfoBase): def _make_result_dict(s): return {'seriesname': s.name, 'id': s.id, 'firstaired': s.premiered, 'network': s.network and s.network.name, - 'genres': s.genres, 'overview': s.summary, + 'genres': isinstance(s.genres, list) and ', '.join(g.lower() for g in s.genres) or s.genres, + 'overview': s.summary, 'aliases': [a.name for a in s.akas], 'image': s.image and s.image.get('original'), 'ids': TVInfoIDs( tvdb=s.externals.get('thetvdb'), rage=s.externals.get('tvrage'), tvmaze=s.id, @@ -319,7 +320,7 @@ class TvMaze(TVInfoBase): if 'days' in show_data.schedule: show_obj['airs_dayofweek'] = ', '.join(show_data.schedule['days']) if show_data.genres: - show_obj['genre'] = '|%s|' % '|'.join(show_data.genres) + show_obj['genre'] = '|%s|' % '|'.join(show_data.genres).lower() if (actors or self.config['actors_enabled']) and not getattr(self.shows.get(sid), 'actors_loaded', False): if show_data.cast: @@ -574,7 +575,7 @@ class TvMaze(TVInfoBase): ti_show.vote_average = show_data.rating and show_data.rating.get('average') ti_show.popularity = show_data.weight ti_show.genre_list = show_data.genres or [] - ti_show.genre = '|%s|' % '|'.join(ti_show.genre_list) + ti_show.genre = '|%s|' % '|'.join(ti_show.genre_list).lower() ti_show.official_site = show_data.official_site ti_show.status = show_data.status ti_show.show_type = show_data.type