Python xbmc.Player() Examples
The following are 30
code examples of xbmc.Player().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
xbmc
, or try the search function
.
Example #1
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 6 votes |
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
Example #2
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: player_monitor.py From plugin.audio.spotify with GNU General Public License v3.0 | 6 votes |
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()
Example #4
Source File: default.py From script.tvtime with GNU General Public License v2.0 | 6 votes |
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')
Example #5
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
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)
Example #7
Source File: DialogXml.py From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 | 6 votes |
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
Example #8
Source File: downloader.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
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')
Example #9
Source File: plugintools.py From tvalacarta with GNU General Public License v3.0 | 6 votes |
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)
Example #10
Source File: msnbc.py From plugin.video.ustvvod with GNU General Public License v2.0 | 6 votes |
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)
Example #11
Source File: player.py From plugin.video.themoviedb.helper with GNU General Public License v3.0 | 6 votes |
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)
Example #12
Source File: default.py From tdw with GNU General Public License v3.0 | 6 votes |
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)
Example #13
Source File: wmodal.py From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 | 5 votes |
def onClick(self, controlID): if (controlID == 2 or controlID == 22): self.close() if(controlID == 33): self.close() self.listitem = xbmcgui.ListItem(xbmcup.app.lang[34028]+' '+self.movieInfo['title'], iconImage=self.movieInfo['poster'], thumbnailImage=self.movieInfo['poster']) link = self.get_trailer(self.movieInfo['trailer']) if(link != False): xbmc.Player().play(link, self.listitem) else: xbmcup.gui.message(xbmcup.app.lang[34032].encode('utf8'))
Example #14
Source File: default.py From kodi with GNU General Public License v3.0 | 5 votes |
def play(self, url, name, lock): self.log("-play:") if (lock == "1"): showErrorMessage("Content blocked by site") return uri = None uri = self.get_rutube(url) if uri != None and uri != False: if not uri.startswith('http'): uri = 'http:' + uri uri = UQT(uri) self.dbg_log('- uri: '+ uri + '\n') data = self.get_url(uri) uri = self.selectQuality(uri, data) if (uri == ""): return if 1: item = xbmcgui.ListItem(name, path = uri, iconImage=self.icon, thumbnailImage=self.icon) xbmcplugin.setResolvedUrl(self.handle, True, item) else: item = xbmcgui.ListItem(name, iconImage=self.icon, thumbnailImage=self.icon) sPlayer = xbmc.Player() item.setInfo( type='Video', infoLabels={'title':name.decode('cp1251')}) item.setProperty('IsPlayable', 'true') sPlayer.play(uri, item) else: showErrorMessage("Sorry. Your region is not supported")
Example #15
Source File: controller.py From plugin.video.crunchyroll with GNU Affero General Public License v3.0 | 5 votes |
def waitForPlayback(timeout=30): """ function that waits for playback """ timer = time.time() + timeout while not xbmc.getCondVisibility("Player.HasMedia"): xbmc.sleep(50) # timeout to prevent infinite loop if time.time() > timer: return False return True
Example #16
Source File: default.py From kodi with GNU General Public License v3.0 | 5 votes |
def activate(self, plugin, url, playable): self.log("Playable %r %s => %s" % (plugin, url, playable)) window = "plugin://%s/?mode=show&url=%s" % (plugin, url) if playable: xbmc.Player().play(window) xbmcplugin.endOfDirectory(self.handle, True) else: xbmc.executebuiltin('Container.Update(%s)' % window)
Example #17
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def onPlayBackEnded(self): xbmc.Player.onPlayBackEnded(self)
Example #18
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
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)
Example #19
Source File: player.py From plugin.video.themoviedb.helper with GNU General Public License v3.0 | 5 votes |
def __init__(self): super(Player, self).__init__() self.traktapi = TraktAPI() self.search_movie, self.search_episode, self.play_movie, self.play_episode = [], [], [], [] self.item = defaultdict(lambda: '+') self.itemlist, self.actions, self.players, self.identifierlist = [], [], {}, [] self.is_local = None self.autoplay_single = self.addon.getSettingBool('autoplay_single') self.dp_local = self.addon.getSettingBool('default_player_local') self.dp_movies = self.addon.getSettingString('default_player_movies') self.dp_episodes = self.addon.getSettingString('default_player_episodes') self.dp_movies_id = None self.dp_episodes_id = None self.fallbacks = {} self.playerstring = None
Example #20
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def onPlayBackStarted(self): print("Player has started")
Example #21
Source File: player_monitor.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def __init__(self, **kwargs): self.__sp = kwargs.get("sp") self.__playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) xbmc.Player.__init__(self, **kwargs)
Example #22
Source File: acecore.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def ace_control_thread(): while json.loads(xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Player.GetActivePlayers","params":{},"id":3}'))["result"]: xbmc.sleep(500) stop_aceengine() #TODO - Windows and proper cache clear
Example #23
Source File: acecore.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def __init__(self): xbmc.Player().stop() self.log=Logger("TSEngine") self.push=Logger('OUT') self.alive=True self.progress = xbmcgui.DialogProgress() self.player=None self.files={} self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._sock.settimeout(3) self.progress.create(translate(30000),translate(30043)) self.tsserv =None self.conn=False self.title=None self.filename=None self.mode=None self.url=None self.local=False self.saved=False self.canceled = False self.pos=[25,50,75,100] l=False while xbmc.Player().isPlaying(): l=True if xbmc.abortRequested: self.log.out("XBMC asked to abort request") return False if self.progress.iscanceled(): self.canceled = True return False xbmc.sleep(300) settings.setSetting('active','1') if l: xbmc.sleep(500)
Example #24
Source File: acecore.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def __init__( self): self.started=False self.log=Logger("TSPlayer") self.log.out('init') self.active=True self.link=None self.vod=True self.duration=None self.coms=[] if settings.getSetting('force_dvplayer') == 'true': xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER)
Example #25
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def break_sopcast(): if xbmc.getCondVisibility('system.platform.windows'): import _winreg aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) try: aKey = _winreg.OpenKey(aReg, r'SOFTWARE\SopCast\Player\InstallPath',0, _winreg.KEY_READ) name, value, type = _winreg.EnumValue(aKey, 0) codec_file = os.path.join(os.path.join(value.replace("SopCast.exe","")),'codec','sop.ocx.old') _winreg.CloseKey(aKey) if xbmcvfs.exists(codec_file): xbmcvfs.rename(codec_file,os.path.join(os.path.join(value.replace("SopCast.exe","")),'codec','sop.ocx')) except:pass
Example #26
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 5 votes |
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(xbmc.PLAYER_CORE_AUTO).isPlaying(): player = streamplayer(xbmc.PLAYER_CORE_AUTO , 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
Example #27
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def onPlayBackEnded(self): 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(xbmc.PLAYER_CORE_AUTO).isPlaying(): player = streamplayer(xbmc.PLAYER_CORE_AUTO , spsc_pid=self.spsc_pid , listitem=self.listitem) player.play(url, self.listitem) try: xbmcvfs.delete(os.path.join(pastaperfil,'sopcast.avi')) except: pass
Example #28
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def onPlayBackStarted(self): mensagemprogresso.close() if xbmc.Player(xbmc.PLAYER_CORE_AUTO).getPlayingFile() != "http://"+LOCAL_IP+":"+str(VIDEO_PORT)+"/" and 'sopcast' not in xbmc.Player(xbmc.PLAYER_CORE_AUTO).getPlayingFile(): try: os.kill(self.spsc_pid,9) except: pass else: pass
Example #29
Source File: sopcast.py From program.plexus with GNU General Public License v2.0 | 5 votes |
def onPlayBackStopped(self): print("Player stoped") self._playbackLock = False import subprocess cmd = ['sc','stop','sopcastp2p'] proc = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True) for line in proc.stdout: print(line.rstrip())
Example #30
Source File: player.py From plugin.video.kmediatorrent with GNU General Public License v3.0 | 5 votes |
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)