Python xbmc.PlayList() Examples
The following are 30
code examples of xbmc.PlayList().
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: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 7 votes |
def PlayList(url): playlist=xbmc.PlayList(0) playlist.clear() #add song to playlist songs = DoubanFM.GetSongs(url) for song in songs: pic = song.pop('pic') url = song.pop('url') listitem=xbmcgui.ListItem(song['title']) listitem.setInfo('Music', song) listitem.setThumbnailImage(pic) playlist.add(url, listitem) print 'Added '+str(playlist.size()) + ' songs' xbmc.Player().play(playlist)
Example #2
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 6 votes |
def playVideo(name, url, thumb): ppurls = [] # if live page without video link, try to get video link from search result if re.match('^http://live\.pptv\.com/list/tv_program/.*$', url): url = GetPPTVSearchList(PPTV_SEARCH_URL + urllib.quote_plus(name), name) if len(url) > 0: quality = int(__addon__.getSetting('movie_quality')) ppurls = GetPPTVVideoURL(url, quality) if len(ppurls) > 0: playlist = xbmc.PlayList(1) playlist.clear() for i in range(0, len(ppurls)): title = name + ' ' + PPTV_TTH + ' ' + str(i + 1) + '/' + str(len(ppurls)) + ' ' + PPTV_FIELD liz = xbmcgui.ListItem(title, thumbnailImage = thumb) liz.setInfo(type = "Video", infoLabels = { "Title" : title }) playlist.add(ppurls[i], liz) xbmc.Player().play(playlist) else: xbmcgui.Dialog().ok(__addonname__, PPTV_MSG_GET_URL_FAILED)
Example #3
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 6 votes |
def PlayVideo(name,type,url,thumb): dialog = xbmcgui.Dialog() list = [x[0] for x in RATE_LIST] sel = dialog.select('类型', list) if sel != -1: rate=RATE_LIST[sel][1] link = GetHttpData(url) match = re.compile('"f":"(.+?)","').findall(link) urllist=match[0] urllist=eval('u"'+urllist+'"').encode('utf-8') vidlist=urllist.split(',') if len(vidlist)>0: playlist=xbmc.PlayList(1) playlist.clear() for i in range(len(vidlist)): listitem = xbmcgui.ListItem(name, thumbnailImage = __addonicon__) listitem.setInfo(type="Video",infoLabels={"Title":name+" 第"+str(i+1)+"/"+str(len(vidlist))+" 节"}) playlist.add(vidlist[i]+'?rate='+rate, listitem) #playlist.add(vidlist[i], listitem) xbmc.Player().play(playlist) else: dialog = xbmcgui.Dialog() ok = dialog.ok(__addonname__, '无法播放:未匹配到视频文件,请稍侯再试或联系作者')
Example #4
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 #5
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 #6
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 #7
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 #8
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 6 votes |
def next_track(self): '''special entry which tells the remote connect player to move to the next track''' cur_playlist_position = xbmc.PlayList(xbmc.PLAYLIST_MUSIC).getposition() # prevent unintentional skipping when Kodi track ends before connect player # playlist position will increse only when play next button is pressed if cur_playlist_position > self.last_playlist_position: # move to next track self.sp.next_track() # give time for connect player to update info xbmc.sleep(100) self.last_playlist_position = cur_playlist_position cur_playback = self.sp.current_playback() trackdetails = cur_playback["item"] url, li = parse_spotify_track(trackdetails, silenced=True) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, li)
Example #9
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 6 votes |
def PlayVideoYouku(name, url, thumb): link = getHttpData("http://www.flvcd.com/parse.php?kw="+url+"&format=high") match = re.compile('"(http://f.youku.com/player/getFlvPath/.+?)" target="_blank"').findall(link) if len(match)>0: playlist=xbmc.PlayList(1) playlist.clear() for i in range(0,len(match)): p_name = name+" 第"+str(i+1)+"节" listitem = xbmcgui.ListItem(p_name, thumbnailImage=thumb) listitem.setInfo(type="Video",infoLabels={"Title":name+" 第"+str(i+1)+"/"+str(len(match))+" 节"}) playlist.add(match[i], listitem) xbmc.Player().play(playlist) else: if link.find('该视频为加密视频')>0: dialog = xbmcgui.Dialog() ok = dialog.ok(__addonname__, '无法播放:该视频为加密视频') elif link.find('解析失败,请确认视频是否被删除')>0: dialog = xbmcgui.Dialog() ok = dialog.ok(__addonname__, '无法播放:该视频或为收费节目') ################################################################################## # Todou Video Player ##################################################################################
Example #10
Source File: plugintools.py From pelisalacarta-ce 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 #11
Source File: main.py From filmkodi with Apache License 2.0 | 6 votes |
def queueAllVideos(self, item): dia = DialogProgress() dia.create('SportsDevil', 'Get videos...' + item['title']) dia.update(0) items = self.getVideos(item, dia) if items: for it in items: item = self.createXBMCListItem(it) queries = {'mode': str(Mode.PLAY), 'url': self.addon.build_plugin_url(it.infos)} uc = self.addon.build_plugin_url(queries) xbmc.PlayList(xbmc.PLAYLIST_VIDEO).add(uc, item) resultLen = len(items) msg = 'Queued ' + str(resultLen) + ' video' if resultLen > 1: msg += 's' dia.update(100, msg) xbmc.sleep(500) dia.update(100, msg,' ',' ') else: dia.update(0, 'No items found',' ') xbmc.sleep(700) dia.close()
Example #12
Source File: default.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def run(self): groupname=self.groupname playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) playlist.clear() if os.path.isfile(FAV_ALBUM): s = read_from_file(FAV_ALBUM) search_list = s.split('\n') for list in search_list: if list != '': list1 = list.split('<>') title = list1[0] url = list1[1] thumb = list1[2] try: plname = list1[3] except: plname = "Ungrouped" if (plname == groupname) or groupname == "All Albums": play_album(title, url, thumb,'mix',False) playlist.shuffle() time.sleep(15)
Example #13
Source File: xbmc_player.py From plugin.video.youtube with GNU General Public License v2.0 | 6 votes |
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
Example #14
Source File: contextmenu.py From plugin.video.ustvvod with GNU General Public License v2.0 | 6 votes |
def queue(): playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) show_title, season, episode, thumb, displayname, qmode, url = args.url.split('<join>') name = base64.b64decode(displayname) item = xbmcgui.ListItem(name, path = url) try: item.setThumbnailImage(thumb) except: pass try: item.setInfo('Video', { 'title' : name, 'season' : season, 'episode' : episode, 'TVShowTitle' : show_title}) except: pass playlist.add(url, item) xbmc.executebuiltin('XBMC.Notification(%s, %s, 5000, %s)' % ("Queued", name, thumb))
Example #15
Source File: wrzuta.py From filmkodi with Apache License 2.0 | 6 votes |
def listsitemsAudio(self,url): query_data = {'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True } link = self.cm.getURLRequestData(query_data) #print ("LINK",link) #<a href="http://raptuss.wrzuta.pl/audio/9ICwJ2ec2ze/ewelina_lisowska_-_jutra_nie_bedzie" class="file-music-title">Ewelina Lisowska - Jutra nie będzie</a> match = re.compile('<div class="file-info">\n\t\t\t\t<a href="(.*?)" class="file-music-title">(.*?)</a>', re.DOTALL).findall(link) pl=xbmc.PlayList(1) pl.clear() if len(match) > 0: log.info('Listuje pliki: ') for i in range(len(match)): #print match[i] listitem = xbmcgui.ListItem( match[i][1].strip(), thumbnailImage='None') url = self.up.getVideoLink(match[i][0]) listitem.setInfo( type="Audio", infoLabels={ "Title": match[i][1].strip() } ) xbmc.PlayList(1).add(url, listitem) xbmc.Player().play(pl) return True
Example #16
Source File: addon.py From filmkodi with Apache License 2.0 | 5 votes |
def get_playlist(self, pl_type, new=False): ''' Return a :class:`xbmc.Playlist` object of the specified type. The available playlist types are defined in the :mod:`xbmc` module and are currently as follows:: xbmc.PLAYLIST_MUSIC = 0 xbmc.PLAYLIST_VIDEO = 1 .. seealso:: :meth:`get_music_playlist`, :meth:`get_video_playlist` Args: pl_type (int): The type of playlist to get. new (bool): If ``False`` (default), get the current :class:`xbmc.Playlist` object of the type specified. If ``True`` then return a new blank :class:`xbmc.Playlist`. Returns: A :class:`xbmc.Playlist` object. ''' pl = xbmc.PlayList(pl_type) if new: pl.clear() return pl
Example #17
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def clearPlayList(self): playlist = xbmc.PlayList(0) playlist.clear()
Example #18
Source File: tvnplayer.py From filmkodi with Apache License 2.0 | 5 votes |
def new_playlist(self, playlist='audio'): playlists = {'audio': 0, 'video': 1} if playlist not in playlists.keys(): log.info('Playlista "%s" jest inwalidą ;).' % playlist) selected_playlist = xbmc.PlayList(playlists[playlist]) selected_playlist.clear() return selected_playlist
Example #19
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def fillPlayList(self, size): playlist = xbmc.PlayList(0) for i in range(size): song = self.nextSong() listItem = xbmcgui.ListItem(song["songName"], thumbnailImage=song["songPicRadio"]) listItem.setInfo(type="Music", infoLabels={"Title":song["songName"],"Artist":song["artistName"],"Album":song["albumName"]}) playlist.add(song["url"], listItem) return playlist
Example #20
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def removePlayedItems(self): playlist = xbmc.PlayList(0) for song in self.playedSongs: playlist.remove(song) log("remove played:%s" % song) self.playedSongs = [] return playlist
Example #21
Source File: addon.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def updateHistory(self, check=True, base=-1): if self.isPlaying() == True: if check == True and self.isM3U8 == True: offset = self.getTime() if (offset > self.base) and (offset < self.base + 1.5): self.last += offset - self.base self.base = offset elif base == -1 or self.isM3U8 == False: self.last = self.getTime() self.base = self.last else: self.last = base self.base = base self.lastpos = xbmc.PlayList(1).getposition()
Example #22
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def playList(fmid, t): playlist = xbmc.PlayList(0) playlist.clear() for song in kugou.getSongs(fmid,t): listitem=xbmcgui.ListItem(song['name']) listitem.setInfo(type="Music",infoLabels={ "Title": song['name']}) playlist.add(kugou.getSongInfo(song['hash']), listitem) xbmc.Player().play(playlist) #播放音乐
Example #23
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def play(self, name, thumb, v_urls = None): self.name = name self.thumb = thumb self.v_urls_size = 0 self.curpos = 0 self.is_active = True self.load_url_sync = False self.xbmc_player_stop = False self.title = name self.mCheck = True self.LOVS = 0 self.v_urls = v_urls if (v_urls): # single video file playback self.curpos = int(__addon__.getSetting('video_fragmentstart')) * 10 self.v_urls_size = len(v_urls) else: # ugc playlist playback self.curpos = int(name.split('.')[0]) - 1 # Get the number of video items in PlayList for ugc playback self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) self.psize = self.playlist.size() self.videoplaycont = __addon__.getSetting('video_vplaycont') self.maxfp = CFRAGMAX[int(__addon__.getSetting('video_cfragmentmax'))] # Start filling first buffer video and start playback self.geturl()
Example #24
Source File: infoplus.py From pelisalacarta-ce with GNU General Public License v3.0 | 5 votes |
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
Example #25
Source File: default.py From ru with GNU General Public License v2.0 | 5 votes |
def addplist(params): li = xbmcgui.ListItem(params['tt']) uri = construct_request({ 'torr_url': params['t'], 'title': params['tt'].decode('utf-8'), 'ind':urllib.unquote_plus(params['i']), 'img':urllib.unquote_plus(params['ii']), 'func': 'play_url' }) xbmc.PlayList(xbmc.PLAYLIST_VIDEO).add(uri,li)
Example #26
Source File: default.py From ru with GNU General Public License v2.0 | 5 votes |
def PLAY(params): #-- get filter parameters par = Get_Parameters(params) # -- if requested continious play if Addon.getSetting('continue_play') == 'true': # create play list pl=xbmc.PlayList(1) pl.clear() # -- get play list playlist = Get_PlayList(par.playlist, par.is_season, par.name, 'e') for rec in playlist: name = rec['comment'] s_url = Check_Video_URL(rec['file']) #-- add item to play list i = xbmcgui.ListItem(name, path = urllib.unquote(s_url), thumbnailImage=par.img) i.setProperty('IsPlayable', 'true') pl.add(s_url, i) xbmc.Player().play(pl) # -- play only selected item else: s_url = Check_Video_URL(par.url) i = xbmcgui.ListItem(par.name, path = urllib.unquote(s_url), thumbnailImage=par.img) i.setProperty('IsPlayable', 'true') xbmcplugin.setResolvedUrl(h, True, i)
Example #27
Source File: xbmc_playlist.py From plugin.video.youtube with GNU General Public License v2.0 | 5 votes |
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
Example #28
Source File: play_base.py From plugin.video.openmeta with GNU General Public License v3.0 | 5 votes |
def action_cancel(): xbmc.PlayList(1).clear() xbmc.PlayList(0).clear() # clearing music playlist somehow removes the playlist notification we get when using play from context menu on Kodi 18... plugin.set_resolved_url() xbmc.executebuiltin('Dialog.Close(okdialog, true)')
Example #29
Source File: xswift2.py From plugin.video.openmeta with GNU General Public License v3.0 | 5 votes |
def add_to_playlist(items, playlist='video'): playlists = {'music': 0, 'video': 1} if playlist not in playlists: raise ValueError('Playlist "%s" is invalid.' % playlist) selected_playlist = xbmc.PlayList(playlists[playlist]) _items = [] for item in items: if not hasattr(item, 'as_xbmc_listitem'): item['info_type'] = playlist item = ListItem.from_dict(**item) _items.append(item) selected_playlist.add(item._path, item.as_xbmc_listitem()) return _items
Example #30
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def PlayVideoSina(name,url,thumb): link = getHttpData(url) match = re.compile(' vid:\'(.+?)\',').findall(link) vid=match[0] vidlist=vid.split('|') #vidlist[0]=普通; vidlist[1]=清晰 url='http://v.iask.com/v_play.php?vid='+vidlist[1]+'&uid=0&pid=1000&tid=4&plid=4002&referrer=http%3A%2F%2Fvideo.sina.com.cn%2Fmovie%2Fdetail%2Fmhls&r=video.sina.com.cn' link = getHttpData(url) match = re.compile('<url><!\[CDATA\[(.+?)\]\]></url>').findall(link) if match: playlist=xbmc.PlayList(1) playlist.clear() for i in range(len(match)): p_name = name+" 第"+str(i+1)+"节" listitem = xbmcgui.ListItem(p_name, thumbnailImage=thumb) listitem.setInfo(type="Video",infoLabels={"Title":name+" 第"+str(i+1)+"/"+str(len(match))+" 节"}) playlist.add(match[i], listitem) xbmc.Player().play(playlist) else: dialog = xbmcgui.Dialog() ok = dialog.ok(__addonname__, '无法播放:未匹配到视频文件,请稍侯再试') ################################################################################## # LeTV Video Link Decode Algorithm & Player # Extract all the video list and start playing first found valid link # User may press <SPACE> bar to select video resolution for playback ##################################################################################