Kodi Community Forum
Kodi Notifications to external windows app - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Kodi Notifications to external windows app (/showthread.php?tid=295497)



Kodi Notifications to external windows app - k_zeon - 2016-11-02

I am creating a small app to control Kodi. I am using VB6.
I have found on the internet that i can receive notifications
by using TCP from my app.
I am using the winsock control to connect and listen to port 9090
(if this is correct port) but i dont seems to get any data being returned.

What exactly do i need to do to receive notifications.

Any help will be appreciated.

Garry


RE: Kodi Notifications to external windows app - Wimpie - 2016-11-02

Haven't used it myself, but I think you need JSON notifications.

http://kodi.wiki/view/JSON-RPC_API/v6#Notifications_2


RE: Kodi Notifications to external windows app - Roman_V_M - 2016-11-02

(2016-11-02, 10:29)Wimpie Wrote: Haven't used it myself, but I think you need JSON notifications.

http://kodi.wiki/view/JSON-RPC_API/v6#Notifications_2

They can be captured with Monitor.onNotification but I don't thinks they are sent anywhere by default.

As for the OP question, it's not clear what data should be sent where. You can pull some info from Kodi via JSON-RPC, but if you need to receive some messages from Kodi to your app, I think you have to create your own addon that will send those messages.


RE: Kodi Notifications to external windows app - k_zeon - 2016-11-02

hi. thanks for replies.

I currently am able to use jsonrpc to control certain functions. (VB6 with inet control)
I can start a Library scan from my windows application , but wanted to know
if i can see when the scan is finished. i can already check for IsLibraryScanning
when i click a button to check. (dont really want to set up timer and poll)
But thought it was possible for Kodi to push Notifications through TCP IP / Port

And then my exe could listen and respond to that.

Thanks


RE: Kodi Notifications to external windows app - k_zeon - 2016-11-03

Just to advise. I have now figured out how to receive notifications in VB6 from kodi.
if anyone else is interested, reply to post.


RE: Kodi Notifications to external windows app - Wimpie - 2016-11-03

I'm interested...


RE: Kodi Notifications to external windows app - k_zeon - 2016-11-03

at work at present so will update when i get home today.

(2016-11-03, 11:03)Wimpie Wrote: I'm interested...



RE: Kodi Notifications to external windows app - k_zeon - 2016-11-04

(2016-11-03, 11:03)Wimpie Wrote: I'm interested...

1st open a new VB6 project and add a form. then add a Winsock component to the form.
then add 2 textboxes txtSend and txtOutput
Code:
Private Sub Form_Load()
    ' The name of the Winsock control is tcpClient.
    ' Note: to specify a remote host, you can use
    ' either the IP address (ex: "121.111.1.1") or
    ' the computer's "friendly" name
    tcpClient.RemoteHost = "192.168.xxx.xxx"
    tcpClient.RemotePort = 9090
     tcpClient.Connect
End Sub

Private Sub Form_Unload(Cancel As Integer)
tcpClient.Close
tcpClient.LocalPort = 0
tcpClient.RemotePort = 0
End Sub

Private Sub tcpClient_DataArrival _
(ByVal bytesTotal As Long)
    Dim strData As String
    tcpClient.GetData strData
    txtOutput.Text = strData
End Sub

Private Sub txtSend_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
   tcpClient.SendData txtSend.Text
   KeyAscii = 0
   End If
End Sub

Now enter the jsonrpc commands into the send textbox and press enter

ie
(xxx.xxx = ip number)

http://192.168.xxx.xxx/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"JSONRPC.Ping"}

you should get a responce back. like {"id":1,"jsonrpc":"2.0","result":"pong"}

if you issue this
http://192.168.xxx.xxx/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}

the txtOutput show show.
{"jsonrpc":"2.0","method":"VideoLibrary.OnScanStarted","params":{"data":null,"sender":"xbmc"}}

when the scan finishes then it will display

{"jsonrpc":"2.0","method":"VideoLibrary.OnScanFinished","params":{"data":null,"sender":"xbmc"}}

i hope this helps you out


RE: Kodi Notifications to external windows app - Wimpie - 2016-11-04

Thanks!!