本文整理汇总了Python中xbmc.PlayList方法的典型用法代码示例。如果您正苦于以下问题:Python xbmc.PlayList方法的具体用法?Python xbmc.PlayList怎么用?Python xbmc.PlayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmc
的用法示例。
在下文中一共展示了xbmc.PlayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: queue
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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))
示例2: run
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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)
示例3: next_track
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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)
示例4: play_connect
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [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
示例5: play_playlist
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [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)
示例6: direct_play
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [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)
示例7: PlayVideoYouku
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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
##################################################################################
示例8: playVideo
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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)
示例9: PlayVideo
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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__, '无法播放:未匹配到视频文件,请稍侯再试或联系作者')
示例10: PlayList
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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)
示例11: play
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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
示例12: listsitemsAudio
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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
示例13: queueAllVideos
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
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()
示例14: run
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [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 ]")
示例15: play
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import PlayList [as 别名]
def play(sys, params):
log('Setting resolving property')
xbmcgui.Window(10000).setProperty(RESOLVING, RESOLVING)
title = urllib.unquote_plus(params['title'])
artist = urllib.unquote_plus(params['artist'])
album = urllib.unquote_plus(params['album'])
track = urllib.unquote_plus(params['track'])
image = urllib.unquote_plus(params['image'])
duration = urllib.unquote_plus(params['duration'])
filename = urllib.unquote_plus(params['filename'])
url = urllib.unquote_plus(params['url'])
log('**** In playFile ****')
log(title)
log(url)
log(filename)
playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
posn = playlist.getposition()
next = posn+1
fetchFile(title, artist, album, track, url, filename)
fetchNext(next)
log('**** FILE %s NOW AVAILABLE ****' % filename)
liz = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image, path=filename)
liz.setInfo('music', {'Title':title, 'Artist':artist, 'Album':album, 'Duration':duration})
liz.setProperty('mimetype', 'audio/mpeg')
liz.setProperty('IsPlayable','true')
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
log('Clearing resolving property')
xbmcgui.Window(10000).clearProperty(RESOLVING)
#------------------------------------------------------------------------