Open a smart playlist in Partymode with JSON
#1
Hi,

I'm now trying to open an existing smart playlist in party mode using a json call but I cant get the syntax correct

I'm looking at the Player.Open section of https://kodi.wiki/view/JSON-RPC_API/v12#Player.Open

but I'm very confused as to how you pass some of the params particularly in this section

Code:

{
          "additionalProperties": false,
          "properties": {
            "partymode": {
              "default": "",
              "type": [
                {
                  "enums": [
                    "music",
                    "video"
                  ],
                  "type": "string"
                },
                {
                  "description": "Path to a smartplaylist (*.xsp) file",
                  "minLength": 5,
                  "type": "string"
                }
              ]
            }
          },
          "type": "object"


I have the following test script where I have tried assorted different positioning of brackets with no success, usually a parse error but I cant find anything that explains where my error actually is

Code:


#!/bin/sh

ipkodi="192.168.xx.yy"
portkodi=zzzz

curl -u User:password  --data-binary '{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"properties": {"partymode": ["music", "special://playlists/music/1950s.xsp"]}}}, "id":1}' -H 'content-type:application/json;' http://$ipkodi:$portkodi/jsonrpc


if anyone could offer any corrections to what I've got wrong I'd very grateful
Reply
#2
The person you need for all this JSON was kicked off the forum, and I just don't use it enough to remember. Digging out my test calls I have this that shows a variety of things:

Code:

[{"jsonrpc": "2.0", "id": 0, "method": "Playlist.Clear", "params": {"playlistid": 0}},
{"jsonrpc":"2.0","id":0,"method":"Playlist.Add","params":{"playlistid":0,"item":{"songid":49030}}},
{"jsonrpc":"2.0","id":0,"method":"Playlist.Add","params":{"playlistid":0,"item":{"file":"C:/BMusicTest/Test/NoTags/Notagshere.mp3"}}},
{"jsonrpc":"2.0","id":0,"method":"Playlist.Add","params":{"playlistid":0,"item":{"recursive":true, "directory":"C:/BMusicTest/Bee Gees/Toplist/TouchedTest.m3u"}}},
{"jsonrpc":"2.0","id":0,"method":"Playlist.Add","params":{"playlistid":0,"item":{"file":"C:/BMusicTest/Dragon/01 - This Is Berk.flac"}}},
{"jsonrpc":"2.0","id":0,"method":"Player.Open","params":{"item":{"playlistid":0,"position":0}}}]
No .xsp in that but should work similar to m3u example. I'm sure not the only way to do it, but a way.
Or try this (before worryoing about party  mode etc.
Code:

{"jsonrpc":"2.0","id":0,"method":"Player.Open","params":{"item":{"file": "FILE PATH NAME HERE OF XSP"}}}

Finally I'm not sure that "special://" will get decoded, you might have to be explicit.
Reply
#3
(2022-05-17, 23:26)DaveBlake Wrote: The person you need for all this JSON was kicked off the forum, and I just don't use it enough to remember. Digging out my test calls I have this that shows a variety of things:
<CUT>
No .xsp in that but should work similar to m3u example. I'm sure not the only way to do it, but a way.
Or try this (before worryoing about party  mode etc.
Code:

{"jsonrpc":"2.0","id":0,"method":"Player.Open","params":{"item":{"file": "FILE PATH NAME HERE OF XSP"}}}

Finally I'm not sure that "special://" will get decoded, you might have to be explicit.
Dave,

thanks for your suggestions. I was doing exactly that get a smart playlist to play before worrying about party mode

through my testing this evening, I can now reliably play both xsp and m3u playlists

I can confirm special:// does not work you have to supply the full pathname to the playlist

Also if you use an xsp smart playlist it has to be opened as a directory

{"jsonrpc": "2.0", "id": "0", "method": "Player.Open", "params": {"item": {"directory": "/storage/.kodi/userdata/playlists/music/1950s.xsp"}}}'

But an m3u playlst has to opened as a file

{"jsonrpc": "2.0", "id": "0", "method": "Player.Open", "params": {"item": {"file": "/storage/.kodi/userdata/playlists/music/1950s.m3u"}}}'

Biggest problem for me is that unless you are a seasoned json person, the documentation for the api is absolutely incomprehensible !!

of  course I can use rules in the xsp files to make them act like partymode, but its not quite the same and the documentation seems to say it should work.

So I'll keep plugging away and hopefully through trial and error I'll work it out
Reply
#4
Glad you are getting somewhere @tkgafs
(2022-05-18, 00:12)tkgafs Wrote: Biggest problem for me is that unless you are a seasoned json person, the documentation for the api is absolutely incomprehensible !!
LOL, tell me about it! All we have are the spec, and an automated web version of that. What would be nice would be a document of working examples for everything, but that needs volunteers with knowledge and time to write and maintain it. Ah well. There are some answers on the JSON subforum, but finding what you want not always easy.
Reply
#5
after a lot of forum searching i eventually found the following post

https://forum.kodi.tv/showthread.php?tid...pid2495137

and this call works for me

curl -u user:password  --data-binary '{"jsonrpc": "2.0", "id": "0", "method": "Player.Open", "params": {"item": { "partymode": "/storage/.kodi/userdata/playlists/music/1950s.xsp"}}}' -H 'content-type:application/json;' http://$ipkodi:$portkodi/jsonrpc

and it obeys the rules in the xsp file

BUT if i define the path as Special://playlists/music/1950s.xsp it appears to only start party mode playing (it certainly doesn't correctly obey the smartplaylist rules

I can generate a debug log if anyone is interested investigating further
Reply
#6
Glad you have what you want working.

Regarding Special:// is it not a normal path and just can't be treated like one in JSON calls or addons. So there is nothing to investigate as far as I am concerned, simply Kodi was not designed to handle Special:// as user input.
Reply

Logout Mark Read Team Forum Stats Members Help
Open a smart playlist in Partymode with JSON0