Kodi Development  20.0
for Binary and Script based Add-Ons

Detailed Description

Kodi's Play List class.

Class: xbmc.PlayList(playList)

To create and edit a playlist which can be handled by the player.

Parameters
playList[integer] To define the stream type
Value Integer String Description
0 xbmc.PLAYLIST_MUSIC Playlist for music files or streams
1 xbmc.PLAYLIST_VIDEO Playlist for video files or streams

Example:

...
play=xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
...

Function Documentation

◆ getPlayListId()

getPlayListId ( )

Function: getPlayListId()


Get the PlayList Identifier

Returns
Id as an integer.

◆ add()

add (   ...)

Function: add(url[, listitem, index])


Adds a new file to the playlist.

Parameters
urlstring or unicode - filename or url to add.
listitem[opt] listitem - used with setInfo() to set different infolabels.
index[opt] integer - position to add playlist item. (default=end)
Note
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.

Example:

..
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
video = 'F:\\movies\\Ironman.mov'
listitem = xbmcgui.ListItem('Ironman', thumbnailImage='F:\\movies\\Ironman.tbn')
listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
playlist.add(url=video, listitem=listitem, index=7)n
..

◆ load()

load (   ...)

Function: load(filename)


Load a playlist.

Clear current playlist and copy items from the file to this Playlist filename can be like .pls or .m3u ...

Parameters
filenameFile with list to play inside
Returns
False if unable to load playlist

◆ remove()

remove (   ...)

Function: remove(filename)


Remove an item with this filename from the playlist.

Parameters
filenameThe file to remove from list.

◆ clear()

clear ( )

Function: clear()


Clear all items in the playlist.

◆ size()

size ( )

Function: size()


Returns the total number of PlayListItems in this playlist.

Returns
Amount of playlist entries.

◆ shuffle()

shuffle ( )

Function: shuffle()


Shuffle the playlist.

◆ unshuffle()

unshuffle ( )

Function: unshuffle()


Unshuffle the playlist.

◆ getposition()

getposition ( )

Function: getposition()


Returns the position of the current song in this playlist.

Returns
Position of the current song