hirsivaja / plugin.video.areena

YLE Areena plugin for Kodi, using the official API.
GNU General Public License v2.0
29 stars 11 forks source link

Function play_stream does not set label or thumbnail for list items #34

Closed T3m3z closed 3 years ago

T3m3z commented 4 years ago

This is a minor problem but as I am using Kodi with Home Automation hub, I noticed that plugin.video.areena never showed the actual title of the video playing. Instead Kodi shows the url of the media as the title. This affects also users who are using the web interface to control Kodi.

Something like this seems to work:

    # Create a playable item with a path to play.
    play_item =  xbmcgui.ListItem(path=path)
    label =  u"Areena"
    if "title" in data:
        for language_code in get_language_codes():
            if language_code in data["title"]:
                label = u"{}: {}".format(label, data["title"][language_code])
                break
    play_item.setLabel(label)
    if "image" in data and "available" in data["image"] and data["image"]["available"]:
        image_url = '{0}/{1}/{2}.{3}'.format(_image_cdn_url, _image_transformation, data['image']['id'], 'png')
        play_item.setThumbnailImage(image_url)
    play_item.setSubtitles(subtitle_list)
    # Report usage to YLE

Nevertheless, I like this plugin very much and have been using it already over a year! Thanks!

hirsivaja commented 3 years ago

Thanks for the code T3m3z. Seems to work fine