python类PlayList()的实例源码

main.py 文件源码 项目:YoutubeTV 作者: dude56987 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def play_all(arrayOfObjects):
    # create the playlist
    playlist= xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    index=1
    # for each item in the playlist
    for item in arrayOfObjects:
        path=item['video']
        # the path to let videos be played by the youtube plugin
        youtubePath='plugin://plugin.video.youtube/?action=play_video&videoid='
        # remove the full webaddress to make youtube plugin work correctly
        path=path.replace('https://youtube.com/watch?v=','')
        # also check for partial webaddresses we only need the video id
        path=path.replace('watch?v=','')
        # add youtube path to path to make videos play with the kodi youtube plugin
        path=youtubePath+path
        # create listitem to insert in the playlist
        list_item = xbmcgui.ListItem(label=item['name'])
        #list_item.setInfo('video', {'title':title , 'genre':'menu' })
        list_item.setInfo('video', item)
        list_item.setArt(item)
        list_item.setProperty('IsPlayable', 'true')
        # add item to the playlist
        playlist.add(path,list_item,index)
        # increment the playlist index
        index+=1
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def play_playlist(self):
        '''play entire playlist'''
        if not self.local_playback:
            self.connect_playback()
        else:
            playlistdetails = self.get_playlist_details(self.ownerid, self.playlistid)
            kodi_playlist = xbmc.PlayList(0)
            kodi_playlist.clear()
            kodi_player = xbmc.Player()
            # add first track and start playing
            url, li = parse_spotify_track(playlistdetails["tracks"]["items"][0])
            kodi_playlist.add(url, li)
            kodi_player.play(kodi_playlist)
            # add remaining tracks to the playlist while already playing
            for track in playlistdetails["tracks"]["items"][1:]:
                url, li = parse_spotify_track(track)
                kodi_playlist.add(url, li)
plugintools.py 文件源码 项目:tvalacarta 作者: tvalacarta 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist)
plugintools.py 文件源码 项目:tvalacarta 作者: tvalacarta 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist)
plugintools.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist)
plugintools.py 文件源码 项目:plugin.video.streamondemand-pureita 作者: orione7 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist)
guis.py 文件源码 项目:script.reddit.reader 作者: gedisony 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def process_clicked_item(self, clicked_item):
        if isinstance(clicked_item, xbmcgui.ListItem ):
            di_url=clicked_item.getProperty('onClick_action') #this property is created when assembling the kwargs.get("listing") for this class
            item_type=clicked_item.getProperty('item_type').lower()
        elif isinstance(clicked_item, xbmcgui.ControlButton ):
            #buttons have no setProperty() hiding it in Label2 no good.
            #ast.literal_eval(cxm_string):
            #di_url=clicked_item.getLabel2()
            #log('  button label2='+repr(di_url))
            #item_type=clicked_item.getProperty('item_type').lower()
            pass

        log( "  clicked %s  IsPlayable=%s  url=%s " %( repr(clicked_item),item_type, di_url )   )
        if item_type=='playable':
                #a big thank you to spoyser (http://forum.kodi.tv/member.php?action=profile&uid=103929) for this help
                pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
                pl.clear()
                pl.add(di_url, clicked_item)
                xbmc.Player().play(pl, windowed=False)
        elif item_type=='script':
            #if user clicked on 'next' we close this screen and load the next page.
            if 'mode=listSubReddit' in di_url:
                self.busy_execute_sleep(di_url,500,True )
            else:
                self.busy_execute_sleep(di_url,3000,False )
guis.py 文件源码 项目:script.reddit.reader 作者: gedisony 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def onClick(self, controlID):
        clicked_control=self.getControl(controlID)
        #log('clicked on controlID='+repr(controlID))
        #button control does not have a property, we use a different method.
        value_to_search=clicked_control.getLabel() #we'll just use the Property('link_url') that we used as button label to search
        listitems=self.listing

        li = next(l for l in listitems if l.getProperty('link_url') == value_to_search)

        item_type=li.getProperty('item_type')
        di_url=li.getProperty('onClick_action')

        log( "  clicked %s  IsPlayable=%s  url=%s " %( repr(clicked_control),item_type, di_url )   )
        if item_type=='playable':
                #a big thank you to spoyser (http://forum.kodi.tv/member.php?action=profile&uid=103929) for this help
                pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
                pl.clear()
                pl.add(di_url, value_to_search)
                xbmc.Player().play(pl, windowed=False)
        elif item_type=='script':
            self.busy_execute_sleep(di_url,5000,False)
actions.py 文件源码 项目:script.reddit.reader 作者: gedisony 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def playVideo(url, name, type_):
    xbmc_busy(False)

    pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    pl.clear()

    if url : #sometimes url is a list of url or just a single string
        if isinstance(url, basestring):
            pl.add(url, xbmcgui.ListItem(name))
            xbmc.Player().play(pl, windowed=False)  #scripts play video like this.
            #listitem = xbmcgui.ListItem(path=url)   #plugins play video like this.
            #xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
        else:
            for u in url:
                #log('u='+ repr(u))
                #pl.add(u)
                pl.add(u, xbmcgui.ListItem(name))
            xbmc.Player().play(pl, windowed=False)
    else:
        log("playVideo(url) url is blank")
xbmc_player.py 文件源码 项目:plugin.video.youtube 作者: jdf76 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def play(self, playlist_index=-1):
        """
        We call the player in this way, because 'Player.play(...)' will call the addon again while the instance is
        running.  This is somehow shitty, because we couldn't release any resources and in our case we couldn't release
        the cache. So this is the solution to prevent a locked database (sqlite).
        """
        self._context.execute('Playlist.PlayOffset(%s,%d)' % (self._player_type, playlist_index))

        """
        playlist = None
        if self._player_type == 'video':
            playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        elif self._player_type == 'music':
            playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)

        if playlist_index >= 0:
            xbmc.Player().play(item=playlist, startpos=playlist_index)
        else:
            xbmc.Player().play(item=playlist)
        """
default.py 文件源码 项目:script.kodi.lifx.ambilight 作者: sanghviharshit 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def onPlayBackStarted(self):
    xbmc.log("Kodi Lifx: DEBUG playback started called on player")
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    self.playlistlen = playlist.size()
    self.playlistpos = playlist.getposition()

    if self.isPlayingVideo() and not self.playingvideo:
      self.playingvideo = True
      self.duration = self.getTotalTime()
      self.movie = xbmc.getCondVisibility('VideoPlayer.Content(movies)')

      global credits_triggered
      credits_triggered = False
      if self.movie and self.duration != 0: #only try if its a movie and has a duration
        get_credits_info(self.getVideoInfoTag().getTitle(), self.duration) # TODO: start it on a timer to not block the beginning of the media
        logger.debuglog("credits_time: %r" % credits_time)
        self.timer = RepeatedTimer(1, self.checkTime)
      state_changed("started", self.duration)
player.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def playAudioPlaylist(self, playlist, startpos=-1, fanart=None):
        self.handler = AudioPlayerHandler(self)
        plist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        plist.clear()
        index = 1
        for track in playlist.items():
            url, li = self.createTrackListItem(track, fanart, index=index)
            plist.add(url, li)
            index += 1

        if playlist.isRemote:
            self.handler.setPlayQueue(playlist)
        else:
            if playlist.startShuffled:
                plist.shuffle()
                xbmc.executebuiltin('PlayerControl(RandomOn)')
            else:
                xbmc.executebuiltin('PlayerControl(RandomOff)')
        self.stopAndWait()
        self.play(plist, startpos=startpos)
xbmc_player.py 文件源码 项目:plugin.video.youtube 作者: Kolifanes 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def play(self, playlist_index=-1):
        """
        We call the player in this way, because 'Player.play(...)' will call the addon again while the instance is
        running.  This is somehow shitty, because we couldn't release any resources and in our case we couldn't release
        the cache. So this is the solution to prevent a locked database (sqlite).
        """
        self._context.execute('Playlist.PlayOffset(%s,%d)' % (self._player_type, playlist_index))

        """
        playlist = None
        if self._player_type == 'video':
            playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            pass
        elif self._player_type == 'music':
            playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
            pass

        if playlist_index >= 0:
            xbmc.Player().play(item=playlist, startpos=playlist_index)
        else:
            xbmc.Player().play(item=playlist)
            pass
        """
        pass
plugintools.py 文件源码 项目:kan-for-kodi 作者: dvircohen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist)
player_monitor.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        self.__sp = kwargs.get("sp")
        self.__spotty = kwargs.get("spotty")
        self.__playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        xbmc.Player.__init__(self, **kwargs)
        threading.Thread.__init__(self)
        self.setDaemon(True)
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def play_connect(self):
        '''start local connect playback - called from webservice when local connect player starts playback'''
        playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        cur_playback = self.sp.current_playback()
        trackdetails = cur_playback["item"]
        url, li = parse_spotify_track(trackdetails, silenced=False, is_connect=True)
        playlist.clear()
        playlist.add(url, li)
        playlist.add("http://localhost:%s/nexttrack" % PROXY_PORT)
        player = xbmc.Player()
        player.play(playlist)
        del playlist
        del player
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def play(self, *args, **kwds):
        self._pl = xbmc.PlayList(0)
        self._pl.clear()
        self._source = SpotifyRadioTrackBuffer(self._seed_tracks)
        self._source.start()

        xbmc.executebuiltin('XBMC.RandomOff')
        xbmc.executebuiltin('XBMC.RepeatOff')

        for _i in range(2):
            self._add_to_playlist()

        xbmc.Player.play(self, self._pl)
default.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def PLAY_STREAM(name,url,iconimage):
    dp = xbmcgui.DialogProgress()
    r='    Please Wait While We Load [COLOR yellow][B]%s[/B][/COLOR]'%(name)
    dp.create("NotFilmOn",'',r,'')
    programme_id=str(iconimage).replace('http://static.filmon.com/couch/channels/','').replace('/big_logo.png','')
    GA_track(programme_id,name)
    liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
    liz.setInfo( type="Video", infoLabels={ "Title": name} )
    liz.setProperty("IsPlayable","true")
    pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    pl.clear()
    pl.add(url, liz)
    xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(pl)
    dp.close()
infoplus.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def onInit(self):
        self.setCoordinateResolution(0)
        if not self.video_url:
            platformtools.dialog_notification("[COLOR crimson][B]Error[/B][/COLOR]", "[COLOR tomato]Vídeo no disponible[/COLOR]", 2)
            self.close()
        elif self.video_url == "no_video":
            self.close()
        else:
            new_video = False
            while True:
                if new_video:
                    self.doModal()
                xlistitem = xbmcgui.ListItem(path=self.video_url, thumbnailImage=self.item.thumbnail)
                pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
                pl.clear()
                pl.add(self.video_url, xlistitem)
                self.player = xbmc.Player()
                self.player.play(pl, windowed=True)
                while xbmc.Player().isPlaying():
                    xbmc.sleep(1000)
                self.close()
                self.video_url = None
                new_video = True
                self.windows[-1].doModal()
                try:
                    self.video_url = self.windows[-1].result
                    if not self.video_url:
                        break
                except:
                    break
actions.py 文件源码 项目:script.reddit.reader 作者: gedisony 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def playURLRVideo(url, name, type_):
    dialog_progress_title='URL Resolver'
    dialog_progress_YTDL = xbmcgui.DialogProgressBG()
    dialog_progress_YTDL.create(dialog_progress_title )
    dialog_progress_YTDL.update(10,dialog_progress_title,translation(32014)  )

    from urlparse import urlparse
    parsed_uri = urlparse( url )
    domain = '{uri.netloc}'.format(uri=parsed_uri)
    try:
        import urlresolver
        #hmf = urlresolver.HostedMediaFile(url)
        dialog_progress_YTDL.update(20,dialog_progress_title,translation(32012)  )

        media_url = urlresolver.resolve(url)
        dialog_progress_YTDL.update(80,dialog_progress_title,translation(32013)  )
        if media_url:
            log( '  URLResolver stream url=' + repr(media_url ))

            pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            pl.clear()
            pl.add(media_url, xbmcgui.ListItem(name))
            xbmc.Player().play(pl, windowed=False)  #scripts play video like this.
        else:
            log( "  Can't URL Resolve:" + repr(url))
            xbmc_notify('URLresolver', translation(32192),icon="type_urlr.png" )  #Failed to get playable url
    except Exception as e:
        xbmc_notify('URLresolver:'+domain, str(e),icon="type_urlr.png" )
    dialog_progress_YTDL.close()
actions.py 文件源码 项目:script.reddit.reader 作者: gedisony 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def loopedPlayback(url, name, type_):
    #for gifs
    #log('*******************loopedplayback ' + url)
    pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    pl.clear()
    pl.add(url, xbmcgui.ListItem(name))
    for _ in range( 0, setting_gif_repeat_count() ):
        pl.add(url, xbmcgui.ListItem(name))

    #pl.add(url, xbmcgui.ListItem(name))
    xbmc.Player().play(pl, windowed=False)
xbmc_playlist.py 文件源码 项目:plugin.video.youtube 作者: jdf76 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __init__(self, playlist_type, context):
        AbstractPlaylist.__init__(self)

        self._context = context
        self._playlist = None
        if playlist_type == 'video':
            self._playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        elif playlist_type == 'audio':
            self._playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
player.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def playQueueCallback(self, **kwargs):
        plist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        # plist.clear()
        try:
            citem = kodijsonrpc.rpc.Player.GetItem(playerid=0, properties=['comment'])['item']
            plexID = citem['comment'].split(':', 1)[0]
        except:
            util.ERROR()
            return

        current = plist.getposition()
        size = plist.size()

        # Remove everything but the current track
        for x in range(size - 1, current, -1):  # First everything with a greater position
            kodijsonrpc.rpc.Playlist.Remove(playlistid=xbmc.PLAYLIST_MUSIC, position=x)
        for x in range(current):  # Then anything with a lesser position
            kodijsonrpc.rpc.Playlist.Remove(playlistid=xbmc.PLAYLIST_MUSIC, position=0)

        swap = None
        for idx, track in enumerate(self.playQueue.items()):
            tid = 'PLEX-{0}'.format(track.ratingKey)
            if tid == plexID:
                # Save the position of the current track in the pq
                swap = idx

            url, li = self.player.createTrackListItem(track, index=idx + 1)

            plist.add(url, li)

        plist[0].setInfo('music', {
            'playcount': swap + 1,
        })

        # Now swap the track to the correct position. This seems to be the only way to update the kodi playlist position to the current track's new position
        if swap is not None:
            kodijsonrpc.rpc.Playlist.Swap(playlistid=xbmc.PLAYLIST_MUSIC, position1=0, position2=swap + 1)
            kodijsonrpc.rpc.Playlist.Remove(playlistid=xbmc.PLAYLIST_MUSIC, position=0)

        self.player.trigger('playlist.changed')
player.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def playAlbum(self, album, startpos=-1, fanart=None):
        self.handler = AudioPlayerHandler(self)
        plist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        plist.clear()
        index = 1
        for track in album.tracks():
            url, li = self.createTrackListItem(track, fanart, index=index)
            plist.add(url, li)
            index += 1
        xbmc.executebuiltin('PlayerControl(RandomOff)')
        self.stopAndWait()
        self.play(plist, startpos=startpos)
xbmc_playlist.py 文件源码 项目:plugin.video.youtube 作者: Kolifanes 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, playlist_type, context):
        AbstractPlaylist.__init__(self)

        self._context = context
        self._playlist = None
        if playlist_type == 'video':
            self._playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            pass
        elif playlist_type == 'audio':
            self._playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
            pass
        pass
sources.py 文件源码 项目:plugin.video.jen 作者: midraal 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def queue_source(item, depth=0):
    """
    queue item
    Keyword Arguments:
    item -- JenItem to try playing
    """
    from resources.lib.util.url import get_addon_url
    jen_item = JenItem(item)
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    if "<item>" in str(jen_item):
        play = False
        if xbmcaddon.Addon().getSetting("autostart_queue") == "true":
            if playlist.size() == 0:
                play = True
        playlist.add(
            get_addon_url("get_sources", str(item)),
            xbmcgui.ListItem(
                jen_item["title"], iconImage=jen_item.get("thumbnail", "")))
        if play:
            play_queue()
    else:
        link = jen_item.get("url", jen_item.get("link", ""))
        jenlist = JenList(link).get_raw_list()
        for list_item in jenlist:
            queue_source(str(list_item), depth + 1)
    if depth == 0:
        xbmcgui.Dialog().notification(
            ADDON.getAddonInfo("name"), _("Finished Queueing").encode('utf-8'),
            ADDON.getAddonInfo("icon"))
        xbmc.executebuiltin("Container.Refresh")
sources.py 文件源码 项目:plugin.video.jen 作者: midraal 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def clear_queue():
    xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
    xbmcgui.Dialog().notification(
        ADDON.getAddonInfo("name"), _("Queue cleared").encode('utf-8'),
        ADDON.getAddonInfo("icon"))
    xbmc.executebuiltin('Container.Refresh')
sources.py 文件源码 项目:plugin.video.jen 作者: midraal 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def play_queue():
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    if playlist.size() > 0:
        item = playlist[0]
        xbmc.Player().play(playlist, item)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
    else:
        xbmcgui.Dialog().notification(
            ADDON.getAddonInfo("name"), _("Queue is empty").encode('utf-8'),
            ADDON.getAddonInfo("icon"))


#  LocalWords:  searchsd HD
player.py 文件源码 项目:plugin.video.jen 作者: midraal 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def play(self, url, item):
        if type(url) == list:
            playlist = xbmc.PlayList()
            for vid in url:
                playlist.add(vid, item)
            xbmc.Player().play(playlist, item)
        else:
            xbmc.Player().play(url, item)
        self.item = item
infoplus.py 文件源码 项目:addon 作者: alfa-addon 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def onInit(self):
        self.setCoordinateResolution(0)
        if not self.video_url:
            platformtools.dialog_notification("[COLOR crimson][B]Error[/B][/COLOR]",
                                              "[COLOR tomato]Vídeo no disponible[/COLOR]", 2)
            self.close()
        elif self.video_url == "no_video":
            self.close()
        else:
            new_video = False
            while True:
                if new_video:
                    self.doModal()
                xlistitem = xbmcgui.ListItem(path=self.video_url, thumbnailImage=self.item.thumbnail)
                pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
                pl.clear()
                pl.add(self.video_url, xlistitem)
                self.player = xbmc.Player()
                self.player.play(pl, windowed=True)
                while xbmc.Player().isPlaying():
                    xbmc.sleep(1000)
                self.close()
                self.video_url = None
                new_video = True
                self.windows[-1].doModal()
                try:
                    self.video_url = self.windows[-1].result
                    if not self.video_url:
                        break
                except:
                    break


问题


面经


文章

微信
公众号

扫码关注公众号