def play_all(arrayOfObjects):
# create the playlist
playlist= xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
index=1
# for each item in the playlist
for item in arrayOfObjects:
path=item['video']
# the path to let videos be played by the youtube plugin
youtubePath='plugin://plugin.video.youtube/?action=play_video&videoid='
# remove the full webaddress to make youtube plugin work correctly
path=path.replace('https://youtube.com/watch?v=','')
# also check for partial webaddresses we only need the video id
path=path.replace('watch?v=','')
# add youtube path to path to make videos play with the kodi youtube plugin
path=youtubePath+path
# create listitem to insert in the playlist
list_item = xbmcgui.ListItem(label=item['name'])
#list_item.setInfo('video', {'title':title , 'genre':'menu' })
list_item.setInfo('video', item)
list_item.setArt(item)
list_item.setProperty('IsPlayable', 'true')
# add item to the playlist
playlist.add(path,list_item,index)
# increment the playlist index
index+=1
评论列表
文章目录