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


Python xbmc.Player方法代码示例

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


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

示例1: deleteFile

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def deleteFile(filename):
    log('Deleting %s' % filename)

    if len(filename) < 1:
        log('Empty filename')
        return

    try:    current = xbmc.Player().getPlayingFile() if xbmc.Player().isPlaying() else ''
    except: current = ''

    while current == filename:
        try:    current = xbmc.Player().getPlayingFile() if xbmc.Player().isPlaying() else ''
        except: current = ''
        xbmc.sleep(1000)

    tries = 15
    while xbmcvfs.exists(filename) and tries > 0:
        tries -= 1 
        try: 
            xbmcvfs.delete(filename)
        except Exception, e: 
            log('ERROR %s in deleteFile %s' % (str(e), filename))
            log('ERROR tries=%d' % tries)
            xbmc.sleep(500) 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:26,代码来源:playerMP3.py

示例2: play

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def play(url, id=0):
	print url
	engine=__settings__.getSetting("Engine")
	if engine=="0":
		play_ace(url, id)
		
	if engine=="1":
		item = xbmcgui.ListItem()#path=url
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
		tthp.play(url, handle, id, __settings__.getSetting("DownloadDirectory"))
		
	if engine=="2":
		purl ="plugin://plugin.video.yatp/?action=play&torrent="+ urllib.quote_plus(url)+"&file_index="+str(id)
		item = xbmcgui.ListItem()#path=purl
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
		xbmc.Player().play(purl) 
开发者ID:tdw1980,项目名称:tdw,代码行数:18,代码来源:default.py

示例3: play_video

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def play_video(video_url = common.args.url):
	hbitrate = -1
	sbitrate = int(addon.getSetting('quality')) * 1024
	closedcaption = None
	video_data = connection.getURL(video_url)
	video_tree = BeautifulSoup(video_data, 'html.parser')
	finalurl = video_tree.video['src']
	try:
		closedcaption = video_tree.find('textstream', type = 'text/vtt')['src']
	except:
		pass
	if (addon.getSetting('enablesubtitles') == 'true') and (closedcaption is not None):
			convert_subtitles(closedcaption)
	xbmcplugin.setResolvedUrl(pluginHandle, True, xbmcgui.ListItem(path = finalurl))
	if (addon.getSetting('enablesubtitles') == 'true') and (closedcaption is not None):
		while not xbmc.Player().isPlaying():
			xbmc.sleep(100)
		xbmc.Player().setSubtitles(ustvpaths.SUBTITLE) 
开发者ID:moneymaker365,项目名称:plugin.video.ustvvod,代码行数:20,代码来源:msnbc.py

示例4: done

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def done(title, dest, downloaded):
    playing = xbmc.Player().isPlaying()

    text = xbmcgui.Window(10000).getProperty('GEN-DOWNLOADED')

    if len(text) > 0:
        text += '[CR]'

    if downloaded:
        text += '%s : %s' % (dest.rsplit(os.sep)[-1], '[COLOR forestgreen]Download succeeded[/COLOR]')
    else:
        text += '%s : %s' % (dest.rsplit(os.sep)[-1], '[COLOR red]Download failed[/COLOR]')

    xbmcgui.Window(10000).setProperty('GEN-DOWNLOADED', text)

    if (not downloaded) or (not playing):
        xbmcgui.Dialog().ok(title, text)
        xbmcgui.Window(10000).clearProperty('GEN-DOWNLOADED') 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:20,代码来源:downloader.py

示例5: __init__

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def __init__ (self):
        xbmc.Player.__init__(self)
        log('Player - init')
        self.token = __addon__.getSetting('token')
        self.facebook = __addon__.getSetting('facebook')
        self.twitter = __addon__.getSetting('twitter')
        self.welcome = __addon__.getSetting('welcome')
        self.notifications = __addon__.getSetting('notifications')
        self.notif_during_playback = __addon__.getSetting('notif_during_playback')
        self.notif_scrobbling = __addon__.getSetting('notif_scrobbling')
        self.progress = __addon__.getSetting('progress')
        self.http = __addon__.getSetting('http')
        self.http_playing = False
        self.emotion = __addon__.getSetting('emotion')
        self.defaultemotion = __addon__.getSetting('defaultemotion')
        if self.token is '':
            log(__language__(32901))
            if self.notifications == 'true':
                notif(__language__(32901), time=2500)
            return
        self.user = self._GetUser()
        if not self.user.is_authenticated:
            return
        self._monitor = Monitor(action = self._reset)
        log('Player - monitor') 
开发者ID:cxii-dev,项目名称:script.tvtime,代码行数:27,代码来源:default.py

示例6: onPlayBackStopped

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def onPlayBackStopped(self):
        self._playbackLock = False
        url = "http://" + LOCAL_IP + ":" + str(VIDEO_PORT) + "/"
        xbmc.sleep(300)
        if os.path.exists("/proc/" + str(self.spsc_pid)) and xbmc.getCondVisibility(
                "Window.IsActive(epg.xml)") and settings.getSetting('safe_stop') == "true":
            if not xbmc.Player().isPlaying():
                player = streamplayer(spsc_pid=self.spsc_pid, listitem=self.listitem)
                player.play(url, self.listitem)
        else:
            try:
                os.kill(self.spsc_pid, 9)
            except:
                pass
        try:
            xbmcvfs.delete(os.path.join(pastaperfil, 'sopcast.avi'))
        except:
            pass 
开发者ID:tvaddonsco,项目名称:program.plexus,代码行数:20,代码来源:sopcast.py

示例7: update_info

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def update_info(self, force):
        cur_playback = self.__sp.current_playback()
        if cur_playback:
            if cur_playback["is_playing"] and (not xbmc.getCondVisibility("Player.Paused") or force):
                player_title = None
                if self.isPlaying():
                    player_title = self.getMusicInfoTag().getTitle().decode("utf-8")
                
                trackdetails = cur_playback["item"]
                if trackdetails is not None and (not player_title or player_title != trackdetails["name"]):
                    log_msg("Next track requested by Spotify Connect player")
                    self.start_playback(trackdetails["id"])
            elif cur_playback["is_playing"] and xbmc.getCondVisibility("Player.Paused"):
                log_msg("Playback resumed from pause requested by Spotify Connect")
                self.__skip_events = True
                self.play()
            elif not xbmc.getCondVisibility("Player.Paused"):
                log_msg("Pause requested by Spotify Connect")
                self.__skip_events = True
                self.pause()
        else:
            self.__skip_events = True
            self.stop() 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:25,代码来源:player_monitor.py

示例8: play_connect

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def play_connect(self):
        '''start local connect playback - called from webservice when local connect player starts playback'''
        playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        trackdetails = None
        count = 0
        while not trackdetails and count < 10:
            try:
                cur_playback = self.sp.current_playback()
                trackdetails = cur_playback["item"]
            except:
                count += 1
                xbmc.sleep(500)
        if not trackdetails:
            log_msg("Could not retrieve trackdetails from api, connect playback aborted", xbmc.LOGERROR)
        else:
            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 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:25,代码来源:plugin_content.py

示例9: play_playlist

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
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) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:19,代码来源:plugin_content.py

示例10: direct_play

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
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) 
开发者ID:tvalacarta,项目名称:tvalacarta,代码行数:20,代码来源:plugintools.py

示例11: onClick

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def onClick(self, controlID):
        if (controlID == 2 or controlID == 22):
            self.close()
        if (controlID == 30):
            self.close()
            self.listitem = xbmcgui.ListItem(self.movieInfo['title'], iconImage=self.movieInfo['poster'], thumbnailImage=self.movieInfo['poster'])
            if(self.quilitybutton.isSelected()):
                xbmc.Player().play(self.movieInfo['direct_url_hq'], self.listitem)
            else:
                xbmc.Player().play(self.movieInfo['direct_url'], self.listitem)

        if(controlID == 33):
            __settings__ = xbmcaddon.Addon(id='plugin.video.watch.is.dev')
            path = xbmc.translatePath(os.path.join(__settings__.getAddonInfo('path').replace(';', ''), ''))
            w = DialogReviews("reviews.xml", path, "Default")
            w.doModal(self.movieInfo['movieHtml'])
            del w 
开发者ID:evgen-dev,项目名称:repository.evgen_dev.xbmc-addons,代码行数:19,代码来源:DialogXml.py

示例12: build_selectbox

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def build_selectbox(self, clearsetting=False, assertplayers=True):
        self.itemlist, self.actions = [], []
        if clearsetting:
            self.itemlist.append(xbmcgui.ListItem(xbmc.getLocalizedString(13403)))  # Clear Default
        if self.is_local:
            self.append_playeraction(u'{0} {1}'.format(self.addon.getLocalizedString(32061), 'Kodi'), self.is_local, identifier='play_kodi')
        for i in sorted(self.play_movie, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'play_movie', assertplayers=assertplayers)
        for i in sorted(self.search_movie, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'search_movie', assertplayers=assertplayers)
        for i in sorted(self.play_episode, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'play_episode', assertplayers=assertplayers)
        for i in sorted(self.search_episode, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'search_episode', assertplayers=assertplayers)
        utils.kodi_log(u'Player -- Built {} Players!\n{}'.format(
            len(self.itemlist), self.identifierlist), 2) 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:18,代码来源:player.py

示例13: onPlayBackStarted

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def onPlayBackStarted(self):
        for f in self.on_playback_started:
            f()
        try: xbmc.Player().setSubtitles(self.subtitles)
        except: pass
        track_event("video", "play", self.display_name) 
开发者ID:jmarth,项目名称:plugin.video.kmediatorrent,代码行数:8,代码来源:player.py

示例14: run

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def run(self):
        import objects
        ''' Workaround for widgets only playback.
            Widgets start with a music playlist, this causes bugs in skin, etc.
            Create a new video playlist for the item and play it.
        '''
        xbmc.sleep(200) # Let Kodi catch up
        LOG.info("-->[ widget play ]")
        play = None

        xbmc.PlayList(xbmc.PLAYLIST_MUSIC).clear()
        xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
        objects.utils.enable_busy_dialog()

        try:
            server = self.params.get('server')

            if not server and not window('emby_online.bool'):
                dialog("notification", heading="{emby}", message=_(33146), icon=xbmcgui.NOTIFICATION_ERROR)

                raise Exception("NotConnected")

            play = objects.PlayStrm(self.params, server)
            play.play()

        except Exception as error:
            LOG.exception(error)
            objects.utils.disable_busy_dialog()
            xbmc.Player().stop() # mute failed playback pop up
            xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()        
        else:
            objects.utils.disable_busy_dialog()
            window('emby.play.widget.bool', True)
            play.start_playback()

        self.server.pending = []
        LOG.info("--<[ widget play ]") 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:39,代码来源:webservice.py

示例15: __init__

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import Player [as 别名]
def __init__(self, monitor=None):

        self.monitor = monitor
        xbmc.Player.__init__(self) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:6,代码来源:player.py


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