Esempio n. 1
0
def new_viditem(v={}, as_dict=False):
    pathdl = plugin.url_for(endpoint=download, vurl=v.get('contentUrl', v.get('hostPageUrl', '')))
    ctxlist = []
    citem = ('Download', 'RunPlugin({0})'.format(pathdl),)
    ctxlist.append(citem)
    pathdel = plugin.url_for(endpoint=fav_del, idvid=v.get('videoId', ''))
    citem = ('DELETE', 'RunPlugin({0})'.format(pathdel),)
    ctxlist.append(citem)
    img = v.get('thumbnail', v.get('thumbnailUrl', 'DefaultVideo.png'))
    lbl = v.get('label', v.get('name', ''))
    lbl2 = v.get('label2', v.get('videoId', ''))
    vidpath = v.get('path', None)
    if vidpath is None:
        vidpath = plugin.url_for(endpoint=play, vtitle=v.get('name', lbl), vurl=v.get('contentUrl', v.get('hostPageUrl', lbl2)))
    xitem = None
    if not as_dict:
        xitem = ListItem(label=lbl, label2=lbl2, icon=img, thumbnail=img, path=vidpath)
        xitem.add_context_menu_items(items=ctxlist, replace_items=False)
        xitem.playable = True
        xitem.is_folder = False
        xitem.set_info(info_type='video', info_labels={'Title': lbl, 'Plot': lbl2, 'Premiered': v.get('datePublished', '')})
        xitem.thumbnail = img
        xitem.icon = img
        idvid = v.get('videoId', 0)
        if idvid is not 0:
            xitem.set_property(key='videoId', value=idvid)
            xitem.set_info(info_type='video', info_labels={'VideoID': idvid})
    else:
        xitem = {'label': lbl, 'label2': lbl2, 'icon': img, 'thumbnail': img, 'is_playable': True, 'path': vidpath}
    return xitem
Esempio n. 2
0
def play_film(identifier):
    mubi_resolved_info = mubi.get_play_url(identifier)
    mubi_film = ListItem(path=mubi_resolved_info['url'])
    if mubi_resolved_info['is_mpd']:
        mubi_film.set_property('inputstreamaddon', 'inputstream.adaptive')
        mubi_film.set_property('inputstream.adaptive.manifest_type', 'mpd')
        if mubi_resolved_info['is_drm']:
            xbmc.log("Playing DRM films is not currently supported", 4)
            return None
            # drm = mubi_resolved_info['drm_item']
            # mubi_film.set_property('inputstream.adaptive.license_key', drm['lurl']+'|'+drm['header']+
            # '|B{SSM}|'+drm['license_field'])
            # mubi_film.set_property('inputstream.adaptive.license_type', "com.widevine.alpha")
    return plugin.set_resolved_url(mubi_film)
Esempio n. 3
0
 def test_set_property(self, mock_set_property):
     item = ListItem()
     item.set_property('foo', 'bar')
     mock_set_property.assert_called_with('foo', 'bar')
Esempio n. 4
0
 def test_set_property(self, mock_set_property):
     item = ListItem()
     item.set_property('foo', 'bar')
     mock_set_property.assert_called_with('foo', 'bar')