Playlist.Add multiple items
#1
Hi all,

I search a method to send a list of audio, video or image files in one call to the API.

I know the "Playlist.Add" method but it send only one item at a time, I search a way to send an array of items instead, where items could be located in different directories.

At this time, I generate a playlist file containing absolute paths to files and I send the path of this playlist to "Player.Open" method, but I have a few problems to share this playlist on the network, and also to find a correct file format for images playlist (or slideshow).

There is the way of sequential calls to "Playlist.Add" but it's heavy regarding to the performance.

Is there anyone who already have a solution for this ?

Thanks in advance...
Reply
#2
You can do a batch JSON-RPC request like this:
Code:
[
  { "jsonrpc": "2.0", "method": "Playlist.Add", ... },
  { "jsonrpc": "2.0", "method": "Playlist.Add", ... },
  { "jsonrpc": "2.0", "method": "Playlist.Add", ... }
]

You'll still have to do a single call to Playlist.Add for every item you want to add but you can do it in a single request which is especially useful over HTTP where you can save quite a few HTTP requests and responses.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
It works fine, I've simplified other parts of my code since I know this feature, thanks Wink
Reply
#4
(2013-04-18, 20:59)Kapzy Wrote: Hi all,

I search a method to send a list of audio, video or image files in one call to the API.

I know the "Playlist.Add" method but it send only one item at a time, I search a way to send an array of items instead, where items could be located in different directories.

At this time, I generate a playlist file containing absolute paths to files and I send the path of this playlist to "Player.Open" method, but I have a few problems to share this playlist on the network, and also to find a correct file format for images playlist (or slideshow).

There is the way of sequential calls to "Playlist.Add" but it's heavy regarding to the performance.

Is there anyone who already have a solution for this ?

Thanks in advance...
You can also do something like this:
{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "Playlist.Add",
    "params": {
        "item":  [
                {
                    "songid": 1
                },
                {
                    "songid": 2
                }
            ]
        ,
       
        "playlistid": 1
    }
    
}

or just replace {"songid" : x} with any other valid playlist.item.
Reply

Logout Mark Read Team Forum Stats Members Help
Playlist.Add multiple items0