• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python xbmcgui.ListItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: show_episodes

def show_episodes(url,offset,show_fanart):
	items = []
	url = urllib.unquote(url)
	url_offset = url+'&offset='+str(offset)
	data = get_page(url_offset)
	total = 0

	if data["content"]:
		content = json.loads(data["content"])
		if "total" in content.keys(): total = content["total"]
		for episode in content["episodes"]:
			liz = build_episode_item(episode,show_fanart)
			if liz:
				items.append((liz.getPath(), liz, False))
	if items:
		totalItems = len(items)
		addDirectoryItems(plugin.handle, items, totalItems=totalItems)
		
		#sort methods
		for method in [SORT_METHOD_UNSORTED,SORT_METHOD_LABEL,SORT_METHOD_EPISODE,SORT_METHOD_VIDEO_RUNTIME]:
			addSortMethod(plugin.handle, sortMethod=method ) 
		
		#next page
		if total and (int(total) - ((int(offset) + 1) * 25)) > 0:
			liz = ListItem(kodiutils.get_string(32016) + " (" + str(int(offset)+2) + ")")
			liz.setInfo( type="Video", infoLabels={"plot":kodiutils.get_string(32016)})
			liz.setArt({"thumb":next_thumb, "fanart": fanart_bg})
			addDirectoryItem(plugin.handle, plugin.url_for(show_episodes, urllib.quote(url, safe=''), int(offset)+1,  urllib.quote(show_fanart, safe='')), liz, True)

		setContent(plugin.handle, 'episodes')
	endOfDirectory(plugin.handle)
开发者ID:Lunatixz,项目名称:repo-plugins,代码行数:31,代码来源:plugin.py


示例2: play

def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    if 'nayakhabar' in url:
        travlink = re.compile('a href="(http://www.canadanepal.+?)".+?<strong>').findall(data)
        if travlink:
            travlink = travlink[0]
            data = Common.getURL(travlink)
    post = common.parseDOM(data, "div", attrs={ "class": "post" })[0]
    Title = common.parseDOM(post, "h2", attrs={ "class": "title"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    entry = common.parseDOM(post, "div", attrs={ "class": "entry"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(entry)
     
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return                
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', { 'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
开发者ID:newatv2user,项目名称:plugin.video.nepalivideos,代码行数:35,代码来源:canadanepal.py


示例3: show_categories

def show_categories(section_id):
    """
    Categories page
    :param section_id: Selected section ID
    :return:
    """
    api = API()

    for item in api.get_categories(int(section_id)):
        # list item:
        li = ListItem(item['name'].capitalize(),
                      iconImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']),
                      thumbnailImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']))
        li.setArt({
            'fanart': '{0}{1}'.format(config['urls']['calm_blurred_arts_host'], item['image'])
        })
        # directory item:
        addDirectoryItem(
                PLUGIN.handle,
                PLUGIN.url_for(show_channels, section_id=section_id, category_id=item['id']),
                li,
                True
        )
    # end of directory:
    endOfDirectory(PLUGIN.handle)
    executebuiltin('Container.SetViewMode({0})'.format(
            config['viewmodes']['thumbnail'][getSkinDir()
            if getSkinDir() in config['viewmodes']['thumbnail'] else 'skin.confluence']
    ))
开发者ID:gedisony,项目名称:repo-plugins,代码行数:29,代码来源:addon.py


示例4: show_dir

def show_dir(subdir = ''):
    try:
        data = get_index_data()
    except http.FetchError:
        return

    subdirs = set()
    if subdir == '':
        depth = 0

        addDirectoryItem(plugin.handle, plugin.url_for(show_live), ListItem('Live Streaming'), True)
    else:
        depth = len(subdir.split('/'))


    for event in sorted(data, key=operator.itemgetter('title')):
        top, down, children = split_pathname(event['webgen_location'], depth)

        if top != subdir or down in subdirs:
            continue
        if children:
            addDirectoryItem(plugin.handle, plugin.url_for(show_dir, subdir = build_path(top, down)),
                    ListItem(down.title()), True)
            subdirs.add(down)
        else:
            item = ListItem(event['title'])
            item.setLabel2(event['acronym'])
            item.setThumbnailImage(event['logo_url'])
            addDirectoryItem(plugin.handle, plugin.url_for(show_conference, conf = event['url'].rsplit('/', 1)[1]),
                    item, True)

    endOfDirectory(plugin.handle)
开发者ID:C0rby,项目名称:plugin.video.media-ccc-de,代码行数:32,代码来源:addon.py


示例5: play

def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.fetch(url)
    panel = common.parseDOM(data, "div", attrs={"class": "panel"})[0]
    Title = re.compile("<h3>Daily Link : (.+?) on").findall(data)
    if Title:
        Title = Title[0]
        Title = common.replaceHTMLCodes(Title)
        Title = Title.encode("utf-8")
    else:
        Title = "Video"
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(panel)
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok("Nothing to play", "A playable url could not be found.")
        return
    else:
        # print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + " Part " + str(count)
            listitem = ListItem(Title, iconImage="", thumbnailImage="")
            listitem.setInfo("video", {"Title": Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
开发者ID:newatv2user,项目名称:plugin.video.nepalivideos,代码行数:32,代码来源:nepalicollections.py


示例6: add

def add(title, url, mimetype, thumb=""):
  if thumb:
    img_path = os.path.join(plugin.path, "resources/images")
    thumb = os.path.join(img_path, thumb)
  li =  ListItem(title, thumbnailImage=thumb)
  li.setProperty('mimetype', mimetype)
  addDirectoryItem(plugin.handle, url, li, False)
开发者ID:helgeh,项目名称:xbmc-addon-nrk,代码行数:7,代码来源:default.py


示例7: play

def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    videoborderbox = common.parseDOM(data, "div", attrs={ "id": "videoarea" })[0]
    Title = common.parseDOM(videoborderbox, "div", {"id": "videotitle"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    videoplayer = common.parseDOM(videoborderbox, "div", attrs={ "id": "videodisplay"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(videoplayer)
    #videoUrl = None 
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return                
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', { 'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
开发者ID:newatv2user,项目名称:plugin.video.nepalivideos,代码行数:30,代码来源:npvideo.py


示例8: show_live

def show_live():
    quality = get_set_quality()
    format = get_set_format()

    data = None
    try:
        data = http.fetch_live(wants_insecure())
    except http.FetchError:
        return

    if len(data.conferences) == 0:
        entry = ListItem('No live event currently, go watch some recordings!')
        addDirectoryItem(plugin.handle, plugin.url_for(show_dir), entry, True)

    for conference in data.conferences:
        for room in conference.rooms:
            want = room.streams_sorted(quality, format)

            # Assumption: want now starts with the "best" alternative,
            # followed by an arbitrary number of translations, after which
            # the first "worse" non-translated stream follows.

            for id, stream in enumerate(want):
                if id > 0 and not stream.translated:
                    break
                extra = ''
                if stream.translated:
                    extra = ' (Translated %i)' % id if id > 1 else ' (Translated)'
                item = ListItem(conference.name + ': ' + room.display + extra)
                item.setProperty('IsPlayable', 'true')
                addDirectoryItem(plugin.handle, stream.url, item, False)

    endOfDirectory(plugin.handle)
开发者ID:cccc,项目名称:plugin.video.media-ccc-de,代码行数:33,代码来源:addon.py


示例9: yoga_class_play_video

def yoga_class_play_video(rtmp_url, play_path, swf_url, xbmc_handle):
    """
    Sets an xbmc ListItem so that it can play the video associated with that selection.

    """
    li = ListItem(path=rtmp_url)
    li.setProperty('PlayPath', play_path);
    li.setProperty('SWFPlayer', swf_url);
    setResolvedUrl(xbmc_handle, True, li)
开发者ID:jacobono,项目名称:xbmc-yogaglo-plugin,代码行数:9,代码来源:xbmc_util.py


示例10: play

def play(track_id):
    media_url = wimp.get_media_url(track_id)
    if not media_url.startswith('http://') and not media_url.startswith('https://'):
        log("media url: %s" % media_url)
        host, tail = media_url.split('/', 1)
        app, playpath = tail.split('/mp4:', 1)
        media_url = 'rtmp://%s app=%s playpath=mp4:%s' % (host, app, playpath)
    li = ListItem(path=media_url)
    mimetype = 'audio/flac' if config.quality == Quality.lossless else 'audio/mpeg'
    li.setProperty('mimetype', mimetype)
    xbmcplugin.setResolvedUrl(plugin.handle, True, li)
开发者ID:TonyPh12345,项目名称:kodibrasilforum,代码行数:11,代码来源:addon.py


示例11: _subreddit_item

def _subreddit_item(title, subreddit_name=None):
    """Return ListItem for given subreddit name with context menu."""
    listitem = ListItem(title)

    if subreddit_name is None:
        subreddit_name = title
    listitem.addContextMenuItems([
        (_('Remove'), 'RunPlugin(%sremove_subreddit/%s/)' % (
            addon.base_url, subreddit_name
        ))
    ])
    return listitem
开发者ID:jaimefrites,项目名称:plugin.media.mored,代码行数:12,代码来源:subreddit_list.py


示例12: view_dir

def view_dir(handle, base_url, nodes, args, titles, thumbs=repeat(''), bgs=repeat('')):
  total = len(titles)
  for node, arg, title, thumb, bg in zip(nodes, args, titles, thumbs, bgs):
    thumb = thumb() if callable(thumb) else thumb
    bg = bg() if callable(bg) else bg
    li = ListItem(title, thumbnailImage=thumb)
    url = "%s?node=%s&arg=%s" % (base_url, node, arg)
    isdir = node != 'play'
    li.setProperty('isplayable', str(not isdir))
    li.setProperty('fanart_image', bg)
    addDirectoryItem(handle, url, li, isdir, total)
  endOfDirectory(handle)
开发者ID:tibnor,项目名称:xbmc-addon-nrk,代码行数:12,代码来源:default.py


示例13: createItem

def createItem(title, thumb):
    li = ListItem(title)
    try:
        li.setThumbnailImage(thumb)
    except: pass
    li.setProperty('IsPlayable', 'true')
    li.setProperty('Music', 'true')
    li.setProperty('mimetype', 'audio/mpeg')
    return li
开发者ID:send2moran,项目名称:ronos-repo,代码行数:9,代码来源:utils.py


示例14: wrapper_endOfDirectory

def wrapper_endOfDirectory(handle, succeeded = True, updateListing = False, cacheToDisc = True):
    global allowedItems
    url = sys.argv[0] + sys.argv[2] + overridemarker + "=true"
    if (getBlocked() > 0):
        title="Blocked %s (%s)" % (getBlockedRatingsString(),getBlocked())
        item = ListItem(title,"",common.__icon__, common.__icon__)
        info={
            "Title":title,
            "Plot":"Some content has been blocked by the Parental Controls addon.  Click to unblock."
            }
        item.setInfo("video",info)
        addDirectoryItem(handle, url, item, False, allowedItems+1)
    return endOfDirectory(handle,succeeded,updateListing,cacheToDisc)
开发者ID:SebBoulet,项目名称:xbmc-parental-controls,代码行数:13,代码来源:wrap.py


示例15: add

 def add(self, label, prefix, type, id=None, img='', icon='', isdir=True, commands=None):
 
     # Make full path for where to look for specified image
     if img != '':
         img = os.path.join(self.rpath, img)
         
     url = Key.build_url(prefix, type=type, id=id)
     li  = ListItem(label, iconImage=icon, thumbnailImage=img)
     if commands:
         li.addContextMenuItems( commands, True )
     ok  = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
     
     return ok
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:13,代码来源:xbmcplugin_rootmenu.py


示例16: view

def view(items, update_listing=False, urls=None):
    total = len(items)
    for i, (item, url) in enumerate(zip(items, urls)):
        if not getattr(item, 'available', True):
            continue
        li = ListItem(item.title)
        set_common_properties(item, li)
        playable = plugin.route_for(url) == play
        if playable:
            set_steam_details(item, li)
        li.setInfo('video', {'count': i, 'title': item.title, 'mediatype': 'video'})
        addDirectoryItem(plugin.handle, url, li, not playable, total)
    endOfDirectory(plugin.handle, updateListing=update_listing)
开发者ID:esnalabu,项目名称:xbmc-addon-nrk,代码行数:13,代码来源:addon.py


示例17: categories

def categories():
	try:
		req = requests.get(BANCA_SAPO_URL).text
	except:
		Dialog().ok(translate(32000), translate(32001))
		sys.exit(0)

	categories_regex = re.findall('<a href="/jornais/(.+?)" class="\[  \]">(.+?)</a>',req)
	for uri,category in categories_regex:
		liz = ListItem(category)
		liz.setArt({"thumb":GLOBAL_NEWSPAPPER_ICON, "fanart": GLOBAL_FANART})
		addDirectoryItem(plugin.handle, plugin.url_for(show_category, uri), liz, True)
	endOfDirectory(plugin.handle)
开发者ID:Lunatixz,项目名称:repo-plugins,代码行数:13,代码来源:plugin.py


示例18: show_category

def show_category(category_id):
	try:
		req = requests.get('{}/{}'.format(BANCA_SAPO_URL, category_id)).text
	except:
		Dialog().ok(translate(32000), translate(32001))
		sys.exit(0)
	match = re.findall('data-original-src="(.+?)".+?data-share-url=.+?title="(.+?)".+?source data-srcset="(.+?)" srcset', req, re.DOTALL)
	for cover, newspapper, thumb in match:
		if thumb.startswith('//'): thumb = '{}{}'.format('http:', thumb) 
		liz = ListItem(newspapper)
		liz.setArt({"thumb":thumb, "fanart": GLOBAL_FANART})
		addDirectoryItem(plugin.handle, cover, liz)
	endOfDirectory(plugin.handle)
开发者ID:Lunatixz,项目名称:repo-plugins,代码行数:13,代码来源:plugin.py


示例19: show_favorites

def show_favorites():
    """
    User's favorite channels list
    :return:
    """
    api = API()
    user = User()
    is_authenticated = user.authenticate()

    if is_authenticated:
        favorites = api.get_favorites(user.username, user.token)
        if len(favorites) > 0:
            for item in favorites:
                # list item:
                li = ListItem(u'{0} {1}'.format(item['title'].replace('CALM RADIO -', '').title(),
                                                '(VIP)' if 'free' not in item['streams'] else '',
                                                item['description']),
                              iconImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']),
                              thumbnailImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']))
                li.setArt({
                    'fanart': '{0}{1}'.format(config['urls']['calm_blurred_arts_host'], item['image'])
                })
                li.addContextMenuItems(
                        [(ADDON.getLocalizedString(32301), 'RunPlugin(plugin://{0}/favorites/remove/{1})'
                          .format(ADDON_ID, item['id']))]
                )
                # directory item:
                addDirectoryItem(
                        PLUGIN.handle,
                        PLUGIN.url_for(play_channel,
                                       category_id=item['category'],
                                       channel_id=item['id']),
                        li
                )
            # set the content of the directory
            setContent(ADDON_HANDLE, 'songs')
            # end of directory:
            endOfDirectory(PLUGIN.handle)
            executebuiltin('Container.SetViewMode({0})'.format(
                    config['viewmodes']['thumbnail'][getSkinDir()
                    if getSkinDir() in config['viewmodes']['thumbnail'] else 'skin.confluence']
            ))
        # favorites list is empty:
        else:
            executebuiltin('Notification("{0}", "{1}")'
                           .format(ADDON.getLocalizedString(30000), ADDON.getLocalizedString(32306)))
    # user is not authenticated:
    else:
        executebuiltin('Notification("{0}", "{1}")'
                       .format(ADDON.getLocalizedString(30000), ADDON.getLocalizedString(32110)))
开发者ID:gedisony,项目名称:repo-plugins,代码行数:50,代码来源:addon.py


示例20: show_episode_list

def show_episode_list(episodes):
    episodes = filter(lambda ep: getattr(ep, 'available', True), episodes)
    for i, item in enumerate(episodes):
        li = ListItem(item.episode)
        set_common_properties(item, li)
        set_steam_details(item, li)
        li.setInfo('video', {
            'title': item.episode,
            'count': i,
            'mediatype': 'episode',
            'tvshowtitle': item.title})

        url = plugin.url_for(play, item.id)
        addDirectoryItem(plugin.handle, url, li, False)
    endOfDirectory(plugin.handle)
开发者ID:esnalabu,项目名称:xbmc-addon-nrk,代码行数:15,代码来源:addon.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xbmcplugin.addDirectoryItem函数代码示例发布时间:2022-05-26
下一篇:
Python xbmcgui.unlock函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap