python类Player()的实例源码

default.py 文件源码 项目:plugin.video.bdyun 作者: caasiu 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def play_music(filepath):
    if isinstance(filepath, str):
        filepath = filepath.decode('utf-8')
    url = playlist_path(filepath, stream=False)
    name = os.path.basename(filepath)
    listitem = xbmcgui.ListItem(name)
    listitem.setInfo(type='Music', infoLabels={'Title': name})

    if url:
        xbmc.Player().play(url, listitem, windowed=False)


# cache the output of content menu
player_monitor.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 23 收藏 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 项目源码 文件源码 阅读 20 收藏 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)
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def onPlayBackEnded(self):
        xbmc.Player.onPlayBackEnded(self)
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def onPlayBackStopped(self):
        self._source.stop()
        self._pl.clear()
        xbmc.Player.onPlayBackStopped(self)
gPlayer.py 文件源码 项目:Python-GoogleDrive-VideoStream 作者: ddurdle 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__( self, *args, **kwargs ):
        xbmc.Player.__init__( self )
        self.isExit = False
        self.seek = 0
        self.package = None
        self.time = 0
        self.service = None
        self.current = 1
        self.playStatus = False
        self.currentURL = ''
player.py 文件源码 项目:plugin.video.lastship 作者: lastship 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__ (self):
        xbmc.Player.__init__(self)
download_and_play.py 文件源码 项目:tvalacarta 作者: tvalacarta 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__( self, *args, **kwargs ):
        logger.info("CustomPlayer.__init__")
        self.actualtime=0
        self.totaltime=0
        self.stopped=False
        xbmc.Player.__init__( self )
xbmctools.py 文件源码 项目:tvalacarta 作者: tvalacarta 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def wait2second():
    logger.info("tvalacarta.platformcode.xbmctools wait2second")

    import time
    contador = 0
    while xbmc.Player().isPlayingVideo()==False:
        logger.info("tvalacarta.platformcode.xbmctools setSubtitles: Waiting 2 seconds for video to start before setting subtitles")
        time.sleep(2)
        contador = contador + 1

        if contador>10:
            break

# TODO: Pasar esto a custom player
xbmctools.py 文件源码 项目:tvalacarta 作者: tvalacarta 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def setSubtitles():
    logger.info("tvalacarta.platformcode.xbmctools setSubtitles")
    import time
    contador = 0
    while xbmc.Player().isPlayingVideo()==False:
        logger.info("tvalacarta.platformcode.xbmctools setSubtitles: Waiting 2 seconds for video to start before setting subtitles")
        time.sleep(2)
        contador = contador + 1

        if contador>10:
            break

    subtitlefile = os.path.join( config.get_data_path(), 'subtitulo.srt' )
    logger.info("tvalacarta.platformcode.xbmctools setting subtitle file %s" % subtitlefile)
    xbmc.Player().setSubtitles(subtitlefile)
scraper1.py 文件源码 项目:forthelulz 作者: munchycool 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def playMedia(title, thumbnail, link, mediaType='Video') :
    """Plays a video

    Arguments:
    title: the title to be displayed
    thumbnail: the thumnail to be used as an icon and thumbnail
    link: the link to the media to be played
    mediaType: the type of media to play, defaults to Video. Known values are Video, Pictures, Music and Programs
    """
    li = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail, path=link)
    li.setInfo(type=mediaType, infoLabels={ "Title": title })
    xbmc.Player().play(item=link, listitem=li)
lulzscraperfunctions.py 文件源码 项目:forthelulz 作者: munchycool 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def playMedia(title, thumbnail, link, mediaType='Video') :
    """Plays a video

    Arguments:
    title: the title to be displayed
    thumbnail: the thumnail to be used as an icon and thumbnail
    link: the link to the media to be played
    mediaType: the type of media to play, defaults to Video. Known values are Video, Pictures, Music and Programs
    """
    li = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail, path=link)
    li.setInfo(type=mediaType, infoLabels={ "Title": title })
    xbmc.Player().play(item=link, listitem=li)
scraper2.py 文件源码 项目:forthelulz 作者: munchycool 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def playMedia(title, thumbnail, link, mediaType='Video') :
    """Plays a video

    Arguments:
    title: the title to be displayed
    thumbnail: the thumnail to be used as an icon and thumbnail
    link: the link to the media to be played
    mediaType: the type of media to play, defaults to Video. Known values are Video, Pictures, Music and Programs
    """
    li = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail, path=link)
    li.setInfo(type=mediaType, infoLabels={ "Title": title })
    xbmc.Player().play(item=link, listitem=li)
forthelulzfunctions.py 文件源码 项目:forthelulz 作者: munchycool 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def playMedia(title, thumbnail, link, mediaType='Video') :
    """Plays a video

    Arguments:
    title: the title to be displayed
    thumbnail: the thumnail to be used as an icon and thumbnail
    link: the link to the media to be played
    mediaType: the type of media to play, defaults to Video. Known values are Video, Pictures, Music and Programs
    """
    li = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail, path=link)
    li.setInfo(type=mediaType, infoLabels={ "Title": title })
    xbmc.Player().play(item=link, listitem=li)
default.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def onInit( self ):
        xbmc.Player().play('%s/resources/skins/DefaultSkin/media/xbmchub.mp3'%ADDON.getAddonInfo('path'))# Music.
        while self.shut > 0:
            xbmc.sleep(1000)
            self.shut -= 1
        xbmc.Player().stop()
        self._close_dialog()
default.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def onClick( self, controlID ): 
        if controlID == 12:
            xbmc.Player().stop()
            self._close_dialog()
        if controlID == 7:
            xbmc.Player().stop()
            self._close_dialog()
default.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def onAction( self, action ):
        if action in [ 5, 6, 7, 9, 10, 92, 117 ] or action.getButtonCode() in [ 275, 257, 261 ]:
            xbmc.Player().stop()
            self._close_dialog()
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()
F4MProxy.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def play(self, url, listitem):
        print 'Now im playing... %s' % url
        self.stopPlaying.clear()
        xbmc.Player().play(url, listitem)


问题


面经


文章

微信
公众号

扫码关注公众号