def threaded_playback(kodi_playlist, startpos, offset): """ Seek immediately after kicking off playback is not reliable. """ player = Player() player.play(kodi_playlist, None, False, startpos) if offset and offset != '0': i = 0 while not player.isPlaying(): sleep(100) i += 1 if i > 100: LOG.error('Could not seek to %s', offset) return js.seek_to(int(offset))
def play_video(videoId): video = repository.get_video(videoId) streams = repository.get_video_streams(video.streamId) item = ListItem(path=streams[0].url) item.setProperty(u'IsPlayable', u'true') item.setInfo( type='Video', infoLabels={'Title': video.title, 'Plot': video.description} ) analytics.trackVideoPlayed(video.slug) playlist = PlayList(PLAYLIST_VIDEO) playlist.clear() playlist.add(streams[0].url, item) player = Player() player.play(playlist)
# authenticate with leafs TV ltv = authenticate() if ltv == None: return # get the archived game URL try: url = ltv.getArchivedGame(game_id) except LeafsTVError, ltvErr: dialog = xbmcgui.Dialog() dialog.ok(__language__(30008),__language__(30010)) return # play the archived game player = Player(xbmc.PLAYER_CORE_AUTO) player.play(url) return # if the second argument is empty this is the main menu if (len(sys.argv[2]) == 0): createMainMenu() elif sys.argv[2] == "?url=archived": createArchivedMenu() elif sys.argv[2] == '?url=live': createLiveMenu() else: match = re.match('\?archive\=(.*)', sys.argv[2]) if match != None: print str(match)
addon_handle = int(sys.argv[1]) xbmcplugin.setContent(addon_handle, 'movies') dialog = xbmcgui.Dialog() input_data = dialog.input('Ingresar nombre, temporada y capitulo', type=xbmcgui.INPUT_ALPHANUM) input_data = input_data.split('/') name, season, episode = input_data args = {'name': name, 'season': season, 'episode': episode, 'serve': True } t = Thread(target=watch, kwargs=args) t.start() dialog = xbmcgui.Dialog() dialog.notification('touchandgo', 'touchandgo is starting waith for it.', xbmcgui.NOTIFICATION_INFO, 60000) video_url = "http://localhost:8888/" player = Player(xbmc.PLAYER_CORE_AUTO) player.play(video_url)