{"error":{"code":-32099,"message":"Bad client permission."},"id":1,"jsonrpc":"2.0"}
#16
(2020-04-02, 12:53)feredy2011 Wrote: before (in past version) i use 3 command for play folder of felash.

With thos3 commands you created a playlist and then you are playing that playlist. You can still use the same commands. Just use them with Curl instead of the web browser.
you simply have to know how to read those %-thingies:

%22 = "
%3A = :
%7B = {
%7D = }
%20 = whitespace

https://www.urldecoder.org/ helps as well. That will show how it's written in clear text and then you can replace the section after the --data
for example clearing your playlist has the --data section:

{"jsonrpc":"2.0","method":"Playlist.Clear","params":{"playlistid":0},"id":1}
The playlist ID might have to change. So you have to check for that first probably.
 
(2020-04-02, 12:53)feredy2011 Wrote: also i test your command for flash memory but dont work .
I just tested that same commend with a mp3 on a folder on my LibreELEC machine and it worked well. So I guess the path is wrong. I can't tell because you missed to post the error message which should come up then. If the path is wrong, then simply check the correct path again.

You could also get me the output of the "mount" command after you have plugged in your USB stick. That might show more which path it is.
(2020-04-02, 12:53)feredy2011 Wrote: but repeat command(one - all - off - random) is not there.
I'm not your personal google Wink I already linked you to the schema and by searching you could have found:
Player.SetRepeat and Player.SetShuffle as methods
You will need the playerID as well for those

For the player.open and a directory, I would suggest to use "directory" as an item and then the path to the directory.

curl -s -X POST http://192.168.1.162:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "directory": "/storage/music/" } }, "id":1}'

Also, please do me a favour. I highly guess you have the webinterface running. PLease enter that by entering the IP of your Pi in a browser followed by the Port you have set up for it. I guess in your case it should be: http://192.168.1.199:80

If the webinterface opens, you have a menu symbol on the bottom right. Click on that, then hit "The lab" and then select "Api browser". Then you will see all available methods. Play around a bit and see how far you will get. I explained most of the stuff already in this thread.
Reply
#17
Player repeat:

curl -s -X POST http://192.168.1.162:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params": { "playerid":2, "repeat": "all" }, "id":1}'

Not tested.
Reply
#18
(2020-04-02, 19:44)DaVu Wrote: Player repeat:

curl -s -X POST http://192.168.1.162:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params": { "playerid":2, "repeat": "all" }, "id":1}'

Not tested.

thank you dear daVu for all help to me. i am just a user of kodi (not developer) but for these commands i am tring for 5 days . i read wiki, read about api V8 V6 V4 , read about json ... but this is very hard for me (because i am beginner and weak in english) and i could not understand Smile so in forum i had friendly request for found these commands . you are a good man and good friend that helped to me. not a personal google Smile and i sincerely thank you.
now clear list and select folder is ok . then start folder is ok with this command :
Code:
curl -s -X POST http://192.168.1.199:80/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"playlistid":0,"position":0}},"id":1}'
just after send i see an error in log of domoticz. music is start play but show a error :
Code:
Message error, unknown type in OnPlay/OnResume message: 'unknown' from '{"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"type":"unknown"},"player":{"playerid":0,"speed":1}},"sender":"xbmc"}}'

also about repeat i test "all" "one" "off" with id 1 and 2 and 0 but dont work
Code:
curl -s -X POST http://192.168.1.199:80/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params": { "playerid":2, "repeat": "all" }, "id":1}'
You've helped a lot so far. If you can help about this too, if not thank you again.
Reply
#19
(2020-04-03, 02:58)feredy2011 Wrote: also about repeat i test "all" "one" "off" with id 1 and 2 and 0 but dont work

As I said above you should test which Player is currently playing. The following command will get you response of the current playing player: 
curl -s -X POST http://127.0.0.1:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.GetActivePlayers","id":0}'
In my case the reponse is: 
{"id":0,"jsonrpc":"2.0","result":[{"playerid":0,"playertype":"internal","type":"audio"}]}
So the playerID = 0 
So we know the player with the ID of "0" is the music player. 
So you have to put that ID into the "repeat"-command as its player ID. In my case: 
curl -s -X POST http://127.0.01:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params":{ "playerid":0, "repeat": "all" },"id":1}'
Sets the repeat and
curl -s -X POST http://127.0.01:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params":{ "playerid":0, "repeat": "off" },"id":1}'
Turns the repeat "off" again.

Sorry, can't help with the error you mentioned.
Reply
#20
Heart 
(2020-04-03, 16:49)DaVu Wrote:
(2020-04-03, 02:58)feredy2011 Wrote: also about repeat i test "all" "one" "off" with id 1 and 2 and 0 but dont work

As I said above you should test which Player is currently playing. The following command will get you response of the current playing player: 
curl -s -X POST http://127.0.0.1:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.GetActivePlayers","id":0}'
In my case the reponse is: 
{"id":0,"jsonrpc":"2.0","result":[{"playerid":0,"playertype":"internal","type":"audio"}]}
So the playerID = 0 
So we know the player with the ID of "0" is the music player. 
So you have to put that ID into the "repeat"-command as its player ID. In my case: 
curl -s -X POST http://127.0.01:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params":{ "playerid":0, "repeat": "all" },"id":1}'
Sets the repeat and
curl -s -X POST http://127.0.01:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.SetRepeat", "params":{ "playerid":0, "repeat": "off" },"id":1}'
Turns the repeat "off" again.

Sorry, can't help with the error you mentioned. 
thank you friend for all help .
Reply

Logout Mark Read Team Forum Stats Members Help
{"error":{"code":-32099,"message":"Bad client permission."},"id":1,"jsonrpc":"2.0"}0