当前位置: 首页>>代码示例>>Python>>正文


Python ListItem.add_stream_info方法代码示例

本文整理汇总了Python中xbmcswift2.ListItem.add_stream_info方法的典型用法代码示例。如果您正苦于以下问题:Python ListItem.add_stream_info方法的具体用法?Python ListItem.add_stream_info怎么用?Python ListItem.add_stream_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbmcswift2.ListItem的用法示例。


在下文中一共展示了ListItem.add_stream_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: play

# 需要导入模块: from xbmcswift2 import ListItem [as 别名]
# 或者: from xbmcswift2.ListItem import add_stream_info [as 别名]
def play(url):
    url = url.decode('utf-8','ignore')
    resolved = u''
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        vitem = ListItem(label=url, path=resolved)
        vitem.is_folder = False
        vitem.set_is_playable = True
        vitem.set_info(type='video', info_labels={'Title': url})
        vitem.add_stream_info(stream_type='video', stream_values={})
        plugin.set_resolved_url(resolved)
        return plugin.play_video(vitem)
    except:
        plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url))
    try:
        if resolved is None or len(resolved) < 5:
            import YoutubeDLWrapper
            ytdl = YoutubeDLWrapper._getYTDL()
            ytdl.clearDownloadParams()
            resolved = ytdl.extract_info(url, download=False)
            vitem = ListItem(label=url, path=resolved)
            vitem.is_folder = False
            vitem.set_is_playable = True
            vitem.set_info(type='video', info_labels={'Title': url})
            vitem.add_stream_info(stream_type='video', stream_values={})
            plugin.set_resolved_url(resolved)
            return plugin.play_video(vitem)
    except:
        plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url))
    return None
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:33,代码来源:addon.py

示例2: tvitem

# 需要导入模块: from xbmcswift2 import ListItem [as 别名]
# 或者: from xbmcswift2.ListItem import add_stream_info [as 别名]
def tvitem(adapter, channel):
    titleandtime = channel.nowstarttimeandtitle()

    item = ListItem(label=channel.name,
                    label2=titleandtime,
                    icon=channel.getimagefile(config.tvconfig.channelsdir),
                    thumbnail=channel.getimagefile(config.tvconfig.channelsdir),
                    path=plugin.url_for(str('play_channel'), adapter=adapter, channelid=str(channel.channelid)))

    item.set_is_playable(True)
    item.set_info('video',
                  {
                      'title': channel.name[:15],
                      'tvshowtitle': titleandtime,
                      'duration': channel.v_nowduration,
                      'plot': channel.v_nowdescription,
                      'plotoutline': channel.v_nowdescription,
                      'tagline': channel.nowstarttimeandtitle(),
                      'playcount': 0,
                      #'cast': channel.v_nowactors,
                      'fanart': channel.v_nowfanart,
                      'extrafanart': channel.v_nowposter,
                      'originaltitle': channel.v_nowtitle,
                      'year': channel.v_nowyear,
                      'album': titleandtime,  # I used album 'cause I haven't found another field to display label2
                      'genre': channel.v_nowgenre
                  })
    item.add_context_menu_items(create_context_menu(channel.name, adapter, channel.channelid), replace_items=True)
    item.add_stream_info('video',
                         {'duration': try_parse_int(channel.v_nowduration) * 60, 'plot': channel.v_nowdescription})
    return item
开发者ID:giogris,项目名称:tvs,代码行数:33,代码来源:addon.py

示例3: test_stream_info

# 需要导入模块: from xbmcswift2 import ListItem [as 别名]
# 或者: from xbmcswift2.ListItem import add_stream_info [as 别名]
 def test_stream_info(self):
     with patch.object(xbmcgui.ListItem, 'addStreamInfo') as mock_stream_info:
         item = ListItem()
         item.add_stream_info('video', {'duration': 185})
         mock_stream_info.assert_called_with('video', {'duration': 185})
         item.add_stream_info('audio', {'languange': 'en'})
         mock_stream_info.assert_called_with('audio', {'languange': 'en'})
开发者ID:Opvolger,项目名称:xbmcswift2,代码行数:9,代码来源:test_listitem.py

示例4: resolveurl

# 需要导入模块: from xbmcswift2 import ListItem [as 别名]
# 或者: from xbmcswift2.ListItem import add_stream_info [as 别名]
def resolveurl():
    url = plugin.keyboard(default='', heading='Video Page URL')
    if url is not None:
        name = url
        if len(url) > 0:
            item = ListItem(label=name, label2=url, icon='DefaultVideo.png', thumbnail='DefaultVideo.png',
                            path=plugin.url_for(endpoint=play, url=url))
            item.set_is_playable(True)
            item.set_info(type='video', info_labels={'Title': url, 'Plot': url})
            item.add_stream_info(stream_type='video', stream_values={})
            playable = play(url)
            plugin.notify(msg=playable.path, title="Playing..")
            plugin.play_video(playable)
    # plugin.redirect(plugin.url_for(index))
    plugin.clear_added_items()
    plugin.end_of_directory()
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:18,代码来源:oldaddon.py


注:本文中的xbmcswift2.ListItem.add_stream_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。