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

Python xbmcswift2.ListItem类代码示例

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

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



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

示例1: test_select

 def test_select(self):
     with patch.object(xbmcgui.ListItem, 'select') as mock_select:
         item = ListItem()
         item.selected = True
         mock_select.assert_called_with(True)
         item.select(False)
         mock_select.assert_called_with(False)
开发者ID:beenje,项目名称:xbmcswift2,代码行数:7,代码来源:test_listitem.py


示例2: test_label

 def test_label(self):
     item = ListItem('foo')
     self.assertEqual(item.label, 'foo')
     item.label = 'bar'
     self.assertEqual(item.label, 'bar')
     item.set_label('baz')
     self.assertEqual(item.get_label(), 'baz')
开发者ID:beenje,项目名称:xbmcswift2,代码行数:7,代码来源:test_listitem.py


示例3: test_stream_info

 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,代码行数:7,代码来源:test_listitem.py


示例4: test_label2

 def test_label2(self):
     item = ListItem('foo')
     self.assertIsNone(item.label2)
     item.label2 = 'bar'
     self.assertEqual(item.label2, 'bar')
     item.set_label2('baz')
     self.assertEqual(item.get_label2(), 'baz')
开发者ID:beenje,项目名称:xbmcswift2,代码行数:7,代码来源:test_listitem.py


示例5: video_detail

def video_detail(seasonId):
    detail = Meiju.video_detail(seasonId)
    season_data = detail["data"]["season"]
    title = season_data["title"]
    SEASON_CACHE[seasonId] = detail["data"]  # store season detail
    history = HISTORY.get("list", None)
    playing_episode = "0"
    if history is not None:
        for l in history:
            if l["seasonId"] == seasonId:
                playing_episode = l["index"]
    for episode in season_data["playUrlList"]:
        label = title + str(episode["episode"])
        if episode["episode"] == playing_episode:
            label = "[B]" + colorize(label, "green") + "[/B]"
        item = ListItem(**{
            'label': label,
            'path': plugin.url_for("play_season", seasonId=seasonId, index=episode["episode"], Esid=episode["episodeSid"]),
        })
        item.set_info("video", {"plot": season_data["brief"],
                                "TVShowTitle": title,
                                "episode": int(episode["episode"]),
                                "season": 0})
        item._listitem.setArt({"poster": season_data["cover"]})
        item.set_is_playable(True)
        yield item
    plugin.set_content('episodes')
开发者ID:brmnh,项目名称:xbmc-addons-chinese,代码行数:27,代码来源:path.py


示例6: play

def play(url):
    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(urllib.unquote(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url) #url)
        #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
        #item = ListItem.from_dict(path=plugurl)
        #item.add_stream_info('video', stream_values={})
        #item.set_is_playable(True)
        #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
        return None
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:55,代码来源:old_addon.py


示例7: tvitem

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,代码行数:31,代码来源:addon.py


示例8: test_from_dict_props

    def test_from_dict_props(self):
        dct = {
            'properties': {'StartOffset': '256.4'},
        }
        item = ListItem.from_dict(**dct)
        self.assertEqual(item.get_property('StartOffset'), '256.4')

        dct = {
            'properties': [('StartOffset', '256.4')],
        }
        item = ListItem.from_dict(**dct)
        self.assertEqual(item.get_property('StartOffset'), '256.4')
开发者ID:Opvolger,项目名称:xbmcswift2,代码行数:12,代码来源:test_listitem.py


示例9: play

def play(artist, track):
    data = getTrack(artist, track)
    print data
    item = ListItem()
    item.set_label('%s - %s' % (artist, track))
    item.set_path(data['url'])
    item.set_played(True)
    xbmcplugin.setResolvedUrl(plugin.handle, True, item.as_xbmc_listitem())
开发者ID:Backmute,项目名称:seppius-xbmc-repo,代码行数:8,代码来源:addon.py


示例10: play

    def play(self, videoId):
        api = NetworkTenVideo()
        media = api.get_media_for_video(videoId)
        self.log.debug("Found media renditions for video: %s", repr(media.items))
        if len(media.items):
            # Blindly go for the highest bitrate for now.
            # Later versions could include a customisable setting of which stream to use
            media_sorted = sorted(media.items, key=lambda m: m.encodingRate, reverse=True)
            media = media_sorted[0]
            path = media.defaultURL
            self.log.info("Using rendition: %s with url: %s" % (media, path))
        else:
            # Fallback to API FLVFullLength (e.g. for live streams)
            media = api.get_fallback_media_for_video(videoId)
            path = media.remoteUrl
            self.log.info("Using fallback rendition: %s with url: %s" % (media, path))

        if path.startswith("rtmp"):
            path = path.replace("&mp4:", " playpath=mp4:")
            path += " swfVfy=true swfUrl=%s pageUrl=%s" % (SWF_URL, PAGE_URL)

        # Set the resolved url, and include media stream info
        item = ListItem.from_dict(path=path)
        item.add_stream_info(
            "video", {"codec": media.videoCodec, "width": media.frameWidth, "height": media.frameHeight}
        )
        self.plugin.set_resolved_url(path)
开发者ID:johnmee,项目名称:plugin.video.catchuptv.au.ten,代码行数:27,代码来源:play.py


示例11: play

  def play(self, videoId):
    api = NetworkTenVideo()
    media = api.get_media_for_video(videoId)
    self.log.debug('Found media renditions for video: %s', repr(media))
    if len(media):
        # Blindly go for the highest bitrate for now.
        # Later versions could include a customisable setting of which stream to use
        media_sorted = sorted(media, key=lambda m: m.encodingRate, reverse=True)
        media = media_sorted[0]
        path = media.url
        self.log.info('Using rendition: %s with url: %s' % (media, path))
    else:
        # Fallback to API FLVFullLength (e.g. for live streams)
        media = api.get_fallback_media_for_video(videoId)
        if media.remoteUrl:
          path = media.remoteUrl
          self.log.info('Using fallback rendition: %s with url: %s' % (media, path))
        else:
          # attempt to deal with DRM'd content by falling back to mobile HLS stream
          path = "http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoId=%s" % videoId
          self.log.info('Using fallback rendition unavailable - falling back to mobile HLS stream: %s' % path)

    if path.startswith('rtmp'):
      path = path.replace('&mp4:', ' playpath=mp4:')
      path += ' swfVfy=true swfUrl=%s pageUrl=%s' % (SWF_URL, PAGE_URL)

    # Set the resolved url, and include media stream info
    item = ListItem.from_dict(path=path)
    item.add_stream_info('video', {'codec': media.videoCodec, 'width': media.frameWidth, 'height': media.frameHeight})
    self.plugin.set_resolved_url(path)
开发者ID:xbmc-catchuptv-au,项目名称:plugin.video.catchuptv.au.ten,代码行数:30,代码来源:play.py


示例12: interactive

def interactive(plugin):
    '''A run mode for the CLI that runs the plugin in a loop based on user
    input.
    '''
    items = [item for item in once(plugin) if not item.get_played()]
    parent_stack = []  # Keep track of parents so we can have a '..' option

    selected_item = get_user_choice(items)
    while selected_item is not None:
        if parent_stack and selected_item == parent_stack[-1]:
            # User selected the parent item, remove from list
            parent_stack.pop()
        else:
            # User selected non parent item, add current url to parent stack
            parent_stack.append(ListItem.from_dict(label='..',
                                                   path=plugin.request.url))
        patch_plugin(plugin, selected_item.get_path())

        # If we have parent items, include the top of the stack in the list
        # item display
        parent_item = None
        if parent_stack:
            parent_item = parent_stack[-1]
        items = [item for item in once(plugin, parent_item=parent_item)
                 if not item.get_played()]
        selected_item = get_user_choice(items)
开发者ID:beenje,项目名称:xbmcswift2,代码行数:26,代码来源:app.py


示例13: test_from_dict

 def test_from_dict(self):
     dct = {
         'label': 'foo',
         'label2': 'bar',
         'icon': 'icon',
         'thumbnail': 'thumbnail',
         'path': 'plugin://my.plugin.id/',
         'selected': True,
         'info': {'title': 'My title'},
         'info_type': 'pictures',
         'properties': [('StartOffset', '256.4')],
         'context_menu': [('label', 'action')],
         'is_playable': True}
     with patch.object(ListItem, 'set_info', spec=True) as mock_set_info:
         item = ListItem.from_dict(**dct)
     self.assertEqual(item.label, 'foo')
     self.assertEqual(item.label2, 'bar')
     self.assertEqual(item.icon, 'icon')
     self.assertEqual(item.thumbnail, 'thumbnail')
     self.assertEqual(item.path, 'plugin://my.plugin.id/')
     self.assertEqual(item.selected, True)
     mock_set_info.assert_called_with('pictures', {'title': 'My title'})
     self.assertEqual(item.get_property('StartOffset'), '256.4')
     self.assertEqual(item.get_context_menu_items(), [('label', 'action')]) 
     self.assertEqual(item.get_property('isPlayable'), 'true')
     self.assertEqual(item.is_folder, False)
开发者ID:beenje,项目名称:xbmcswift2,代码行数:26,代码来源:test_listitem.py


示例14: get_album

def get_album(albumId):
    c_list = Meiju.get_album(albumId)
    for one in c_list["data"]["results"]:
        item = ListItem(**{
            'label': one.get("title"),
            'path': plugin.url_for("detail", seasonId=one.get("id")),
            'icon': one["cover"],
            'thumbnail': one["cover"],
        })
        item.set_info("video", {"plot": one.get("brief", ""),
                                "rating ": float(one["score"]),
                                "genre": one["cat"],
                                "season": one["seasonNo"]})
        item.set_is_playable(False)
        yield item
    plugin.set_content('TVShows')
开发者ID:2php,项目名称:xbmc-addons-chinese,代码行数:16,代码来源:path.py


示例15: episode

def episode(name='', url=''):
    waserror = False
    linklist = []
    if len(url) == '':
        waserror = True
    else:
        html = DL(url)
        litems = []
        linklist = findvidlinks(html)
        itemparent = None
    if len(linklist) > 0:
        for name, link in linklist:
            itempath = plugin.url_for(play, url=link)
            item = dict(label=name, label2=link, icon='DefaultFolder.png', thumbnail='DefaultFolder.png', path=itempath)
            item.setdefault(item.keys()[0])
            litems.append(item)
        vitems = sortSourceItems(litems)
        litems = []
        for li in vitems:
            item = ListItem.from_dict(**li)
            item.set_is_playable(True)
            item.set_info(type='video', info_labels={'Title': item.label, 'Plot': item.label2})
            item.add_stream_info(stream_type='video', stream_values={})
            litems.append(item)
    else:
        waserror = True
    if waserror:
        plugin.notify(title="ERROR No links: {0}".format(name), msg=url)
        return []
    return litems
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:30,代码来源:oldaddon.py


示例16: get_track_item

def get_track_item(track, album = None, band = None):
    if not album:
        if track.get('album_id',None):
            album = bc.album_info(track['album_id'])
        else:album = {}

    if not band:
        band = bc.band_info(track['band_id'])

    art = track.get('large_art_url', album.get('large_art_url',None))
    release_date = track.get('release_date', album.get('release_date',None))
    artist = track.get('artist', album.get('artist', band['name']))
    if track.get('number',None):
        label = u"{0} - {1}".format(track['number'], track['title'])
    else: label = track['title']
    li = ListItem(
        label = label,
        icon=art,
        thumbnail=art,
        path=plugin.url_for('play_track', track_id = track['track_id']),
    )
    li.set_property('mimetype','audio/mpeg')
    li.set_is_playable(True)
    infos = {
        'title':track['title'],
        'tracknumber':track.get('number',None),
        'duration':track['duration'],
        'lyrics':track.get('lyrics',''),
        'album':album.get('title',None),
        'artist':artist,
        'year':year_from_timestamp(release_date)
    }
    li.set_info('Music', infos)
    return li
开发者ID:plule,项目名称:plugin.audio.bandcamp,代码行数:34,代码来源:default.py


示例17: playurl

def playurl():
    url = ''
    url = plugin.keyboard(default='', heading='Video Page URL')
    if url != '' and len(url) > 0:
        item = ListItem.from_dict(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={})
        return play(url)
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:9,代码来源:old_addon.py


示例18: playfirst

def playfirst(url=''):
    idx = 0
    if len(url) < 1:
        return None
    thispath = plugin.url_for(endpoint=play, url=url)
    selItem = None
    outtxt = "Not Found"
    try:
        for fitem in plugin.added_items:
            if fitem.selected == True or fitem.path.find(thispath) != -1:
                try:
                    plugin.set_resolved_url(fitem)
                    fitem.is_playable(True)
                    fitem.played(True)
                except:
                    pass
                selItem = fitem
                plugin.notify(msg=selItem.label, title="Found item")
                break
    except:
        selItem = None
    if selItem is not None:
        try:
            selItem.set_is_playable(True)
            selItem.set_played(was_played=True)
            outtxt = selItem.label + " " + selItem.label2
        except:
            outtxt = str(repr(selItem))
    plugin.notify(msg=outtxt, title=str(idx))
    html = DL(url)
    prefhost = ''
    sourceslist = []
    stext = plugin.get_setting('topSources')
    if len(stext) < 1:
        prefhost = 'thevideo'
    else:
        sourceslist = stext.split(',')
        prefhost = sourceslist[0]
    litems = []
    linklist = findvidlinks(html, findhost=prefhost)
    if len(linklist) > 0:
        name, link = linklist[0]
        itempath = plugin.url_for(play, url=link)
        sitem = dict(label=name, label2=link, icon='DefaultFolder.png', thumbnail='DefaultFolder.png', path=itempath)
        sitem.setdefault(sitem.keys()[0])
        item = ListItem.from_dict(**sitem)
        item.set_is_playable(True)
        item.set_info(type='video', info_labels={'Title': item.label, 'Plot': item.label2})
        item.add_stream_info(stream_type='video', stream_values={})
        plugin.notify(msg=link, title=name)
        # plugin.add_items([item])
        item.set_played(was_played=True)
        # plugin.add_items([plugin.set_resolved_url(link)])#.as_tuple())])
        plugin.play_video(item)
        return [plugin.set_resolved_url(item)]
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:55,代码来源:oldaddon.py


示例19: processPlaylists

def processPlaylists(playlists):
    items = []
    for playlist in playlists:
        item = ListItem()
        title = playlist['name']
        if plugin.get_setting('Show owner') == 'true':
            title += ' @' + playlist['user']['login']
        item.set_label(title)
        item.set_thumbnail(playlist['images']['large'])
        item.set_path(plugin.url_for('playlist', playlist_id = str(playlist['playlistId'])))
        item.set_info('music', {
            'Album': playlist['name'],
            'TrackNumber': playlist['itemsCount']
        })
        items.append(item)
    return items
开发者ID:Backmute,项目名称:seppius-xbmc-repo,代码行数:16,代码来源:addon.py


示例20: get_album_item

def get_album_item(album, band = None):
    if (not band) and (not album.get('artist',None)):
        band = bc.band_info(album['band_id'])

    year = year_from_timestamp(int(album['release_date']))
    artist = album.get('artist', band['name'])

    li = ListItem(
        label = u"{1} - {0}".format(album['title'], year),
        icon=album['large_art_url'],
        thumbnail=album['large_art_url'],
        path=plugin.url_for('show_album', album_id = album['album_id'])
    )
    infos = {
        'year':year,
        'album':album['title'],
        'artist':artist
    }
    li.set_info('Music', infos)
    return li
开发者ID:plule,项目名称:plugin.audio.bandcamp,代码行数:20,代码来源:default.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python xbmcswift2.Plugin类代码示例发布时间:2022-05-26
下一篇:
Python xbmcplugin.setSetting函数代码示例发布时间: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