Returning results to a json-rpc addon invocation
#1
Hi.

I've been looking around the forum these last days and have found this question asked several times, but never answered...

I am managing to invoke python executables through json-rpc calls, using the Addons.ExecuteAddon command. 

However, when such calls are successful, I get a success message like "{"id":0,"jsonrpc":"2.0","result":"OK"}"

Is there some way the addon can return a different message, with some extra content, eg, some json expression with a list of songs?

Bye and thanks, Luís
Reply
#2
not 100% sure, but perhaps this method will work:
https://kodi.wiki/view/JSON-RPC_API/v9#J....NotifyAll
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Hi, thanks for the reply.

I suppose your suggestion does not fully comply with what I wanted, since that would be, somehow, an asynchronous response, and it would be broadcast to everyone connected, and not simply to whoever made the json-rpc call.

In spite of that, for the purpose I have, that might be an option, and I will investigate...

I would welcome other suggestions, though...

Bye and thanks, Luís
Reply
#4
I was indeed trying to investigate the NotifyAll option. From the linked documentation, I can read that this will "Notify all other connected clients". The problem is that I don't know how to connect clients, and which types of clients could possibly connect...

Any hints on this?

Bye and thanks, Luís
Reply
#5
(2018-12-21, 00:25)lumo Wrote: Hi, thanks for the reply.

I suppose your suggestion does not fully comply with what I wanted, since that would be, somehow, an asynchronous response, and it would be broadcast to everyone connected, and not simply to whoever made the json-rpc call.

In spite of that, for the purpose I have, that might be an option, and I will investigate...

I would welcome other suggestions, though...

Bye and thanks, Luís
Your question is perplexing... The response you are receiving "result":"ok" is hardcoded to Kodi and meant as a confirmation of query; There are no json-rpc backends in existence (ANYWHERE) that allow third-party's to change this response.

As @ronie explained; use Kodis json-rpc to generate a custom notification.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#6
(2018-12-21, 00:51)lumo Wrote: I was indeed trying to investigate the NotifyAll option. From the linked documentation, I can read that this will "Notify all other connected clients". The problem is that I don't know how to connect clients, and which types of clients could possibly connect...

Any hints on this?

Bye and thanks, Luís
 Use below for individual endpoints.
python:
{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Hello","message":"World"},"id":1}
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#7
Thanks.

I am indeed trying to follow ronie's suggestions, but I'm needing more info on this, since I am new to the whole thing... 

Bye, Luís
Reply
#8
I've managed to subscribe to notifies using websockets, in case someone else is interested.

A running example can be found at https://forum.kodi.tv/showthread.php?tid=165814

Best regards, Luís
Reply

Logout Mark Read Team Forum Stats Members Help
Returning results to a json-rpc addon invocation0