diff --git a/resources/lib/metadata.py b/resources/lib/metadata.py index e285d48c..757c05cb 100644 --- a/resources/lib/metadata.py +++ b/resources/lib/metadata.py @@ -235,6 +235,18 @@ def get_tvshowtitle(api_data): # Not Found return '' + @staticmethod + def get_mpaa(api_data): + """Get film rating string from single item json api data""" + + # VRT NU Search API + if api_data.get('type') == 'episode': + if api_data.get('ageGroup'): + return api_data.get('ageGroup') + + # Not Found + return '' + @staticmethod def get_duration(api_data): """Get duration int from single item json api data""" @@ -310,6 +322,19 @@ def get_plot(self, api_data, season=False, date=None): plot_meta += ' ' plot_meta += localize(30201) # Geo-blocked + # Add product placement + if api_data.get('productPlacement') is True: + if plot_meta: + plot_meta += ' ' + plot_meta += '[B]PP[/B]' + + # Add film rating + rating = self.get_mpaa(api_data) + if rating: + if plot_meta: + plot_meta += ' ' + plot_meta += '[B]%s[/B]' % rating + plot = html_to_kodi(api_data.get('description', '')) if plot_meta: @@ -614,6 +639,7 @@ def get_info_labels(self, api_data, season=False, date=None, channel=None): playcount=self.get_playcount(api_data), plot=self.get_plot(api_data, season=season), plotoutline=self.get_plotoutline(api_data, season=season), + mpaa=self.get_mpaa(api_data), tagline=self.get_plotoutline(api_data, season=season), duration=self.get_duration(api_data), mediatype=self.get_mediatype(api_data, season=season), diff --git a/resources/lib/webscraper.py b/resources/lib/webscraper.py index c41c2fb4..80cfb221 100644 --- a/resources/lib/webscraper.py +++ b/resources/lib/webscraper.py @@ -12,6 +12,7 @@ from kodiutils import get_cache, log_error, open_url, ttl, update_cache from utils import assetpath_to_id + def get_video_attributes(vrtnu_url): """Return a dictionary with video attributes by scraping the VRT NU website"""