Skip to content

Commit

Permalink
Add product placement and kijkwijzer metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister committed Sep 28, 2020
1 parent 9b7105d commit f59cc33
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions resources/lib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions resources/lib/webscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down

0 comments on commit f59cc33

Please sign in to comment.