Skip to content

Commit

Permalink
Add poster support (#820)
Browse files Browse the repository at this point in the history
Since recently the VRT NU metadat contains poster information.
And this looks really nice in the Kodi interface!
  • Loading branch information
dagwieers authored Oct 16, 2020
1 parent e575a9c commit 877f570
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 2 additions & 4 deletions resources/lib/kodiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,10 +1114,8 @@ def open_url(url, data=None, headers=None, method=None, cookiejar=None, follow_r
return None
if exc.code in (400, 403) and exc.headers.get('Content-Type') and 'application/json' in exc.headers.get('Content-Type'):
return exc
reason = exc.reason
code = exc.code
ok_dialog(heading='HTTP Error {code}'.format(code=code), message='{}\n{}'.format(url, reason))
log_error('HTTP Error {code}: {reason}', code=code, reason=reason)
ok_dialog(heading='HTTP Error {code}'.format(code=exc.code), message='{}\n{}'.format(url, exc.reason))
log_error('HTTP Error {code}: {reason}', code=exc.code, reason=exc.reason)
return None
except URLError as exc:
ok_dialog(heading=localize(30968), message=localize(30969))
Expand Down
11 changes: 10 additions & 1 deletion resources/lib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,18 +580,24 @@ def get_art(api_data, season=False):
if season:
if get_setting_bool('showfanart', default=True):
art_dict['fanart'] = add_https_proto(api_data.get('programImageUrl', 'DefaultSets.png'))
art_dict['banner'] = art_dict.get('fanart')
if season != 'allseasons':
art_dict['thumb'] = add_https_proto(api_data.get('videoThumbnailUrl', art_dict.get('fanart')))
else:
art_dict['thumb'] = art_dict.get('fanart')
art_dict['banner'] = art_dict.get('fanart')
if api_data.get('programAlternativeImageUrl'):
art_dict['cover'] = add_https_proto(api_data.get('programAlternativeImageUrl'))
art_dict['poster'] = add_https_proto(api_data.get('programAlternativeImageUrl'))
else:
art_dict['thumb'] = 'DefaultSets.png'
else:
if get_setting_bool('showfanart', default=True):
art_dict['thumb'] = add_https_proto(api_data.get('videoThumbnailUrl', 'DefaultAddonVideo.png'))
art_dict['fanart'] = add_https_proto(api_data.get('programImageUrl', art_dict.get('thumb')))
art_dict['banner'] = art_dict.get('fanart')
if api_data.get('programAlternativeImageUrl'):
art_dict['cover'] = add_https_proto(api_data.get('programAlternativeImageUrl'))
art_dict['poster'] = add_https_proto(api_data.get('programAlternativeImageUrl'))
else:
art_dict['thumb'] = 'DefaultAddonVideo.png'

Expand All @@ -603,6 +609,9 @@ def get_art(api_data, season=False):
art_dict['thumb'] = add_https_proto(api_data.get('thumbnail', 'DefaultAddonVideo.png'))
art_dict['fanart'] = art_dict.get('thumb')
art_dict['banner'] = art_dict.get('fanart')
if api_data.get('alternativeImage'):
art_dict['cover'] = add_https_proto(api_data.get('alternativeImage'))
art_dict['poster'] = add_https_proto(api_data.get('alternativeImage'))
else:
art_dict['thumb'] = 'DefaultAddonVideo.png'

Expand Down

0 comments on commit 877f570

Please sign in to comment.