JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174) +---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
- barrygordon - 2010-10-15 welshboy, I have had my best results using the raw TCP Socket. You enable that I believe in system/network "allow external control". The TCP port is 9090. you send to the port a simple sequence that looks like : "POST /jsonrpc\r\n\r\n"+ the JSON object you wish to transmit as in "POST /jsonrpc\r\n\r\n"+"{\"jsonrpc\": \"2.0\", \"method\": \"JSONRPC.Version\", \"id\": 1}" This will return the version of JSON that is running. Took me a few days to figure it out so I empathize. I am not sure if the blank line between the "Prefix" and the JSON object is needed. You may be able to get away with a prefix of "POST /jsonrpc\r\n" or "POST /jsonrpc ". The above is all javascript syntax - topfs2 - 2010-10-15 barrygordon Wrote:welshboy, I have had my best results using the raw TCP Socket. You enable that I believe in system/network "allow external control". The TCP port is 9090. you send to the port a simple sequence that looks like : Well on the RAW port you don't need to do anything besides send jsonobjects, we do strip anything which isnt' a jsonobject but you don't need to send it. So for raw just putty in and {\"jsonrpc\": \"2.0\", \"method\": \"JSONRPC.Version\", \"id\": 1} - Ilia - 2010-10-15 I might be doing something wrong, but does the sortmethod for GetMovies and GetRecentlyAddedMovies work? curl -i -X POST -d '{"jsonrpc": "2.0", "method": "VideoLibrary.GetRecentlyAddedMovies","params":{"fields":["rating"],"sortmethod":"rating","sortorder":"ascending"}, "id": 1}' http://localhost:8080/jsonrpc ?? - topfs2 - 2010-10-15 Ilia Wrote:I might be doing something wrong, but does the sortmethod for GetMovies and GetRecentlyAddedMovies work? It has been changed, its sort: { "method": "rating", "order": "ascending" } - hello_man - 2010-10-15 topfs2 Wrote:It has been changed, its sort: { "method": "rating", "order": "ascending" } Topfs2, is there any documenation or some way to know all the apis exposed and their respective parameters and return value? thanks, - Ilia - 2010-10-15 topfs2 Wrote:It has been changed, its sort: { "method": "rating", "order": "ascending" } Thanks for the reply, but I am still not getting the right result curl -i -X POST -d '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies","params":{"fields":["rating"],"method":"rating","order":"ascending"}, "id": 1}' http://localhost:8080/jsonrpc It still sorts then by movieid - Ilia - 2010-10-15 hello_man Wrote:Topfs2, is there any documenation or some way to know all the apis exposed and their respective parameters and return value? There is a wiki page at http://wiki.xbmc.org/index.php?title=JSON_RPC, but it seems to be out of date and incomplete - dstruktiv - 2010-10-15 JSONRPC.Introspect and digging through the c++ jsonrpc code in the xbmc svn (Everything's easy to read even if c++ is new to you). JSON-RPC interface is still in beta and under heavy development I don't think it's fair to expect all documentation to be 100% accurate and up to date. - barrygordon - 2010-10-15 Thanks for the simplification. It will make things simpler and a trivial change since most of the code I wrote is table driven for flexibility!! - Ilia - 2010-10-15 Found it, by digging though cpp, if anyone is intrested: "sort":{"method":"videorating","order":"descending"} <- make sure u have no spaces between the "" other methods: date, size, file, drivetype, track, duration, title, artists, album, genre, year, videorating, programcount, playlist, episode, title (video), sorttitle (without "the") productioncode, songrating, mpaarating, videoruntime, studio, fullpath, lastplayer, unsorted, max all available to see in xbmc/lib/libjsonrpc/FileItemHandler.cpp - Montellese - 2010-10-15 Hey guys As Soundgraph has released a first API to access their LCDs and VFDs from 3rd party applications I started writing a tool (with C#) which uses the JSON-RPC service XBMC provides with Dharma to display information about currently playing items on the LCD/VFD. I found the xbmc-json library developped by dstruktiv and think it's quite useful. But I am lacking the possibility of receiving announcements (I absolutely don't want to poll the status of the players every second or so). Could someone please provide me some detailed information on how to catch those announcements? As far as I found out these are broadcasted over TCP on port 9090. Is that correct and is that port fixed or do I need to configure it somewhere? - topfs2 - 2010-10-15 Montellese Wrote:Could someone please provide me some detailed information on how to catch those announcements? As far as I found out these are broadcasted over TCP on port 9090. Is that correct and is that port fixed or do I need to configure it somewhere? Just open a TCP socket to 9090 and there you have it. By default you are listening to all announcements but for future reference you can use the SetAnnouncementFlags to tell which you actually are interested in. To test just use putty against 9090 and you'll get the data. No way to configure, always 9090. It should be announced over zeroconf which is a good way to handle if it ever changes. - Montellese - 2010-10-15 topfs2 Wrote:Just open a TCP socket to 9090 and there you have it. By default you are listening to all announcements but for future reference you can use the SetAnnouncementFlags to tell which you actually are interested in. Thanks. Just wanted to confirm the details on the port and the protocol as it is not available in the wiki article. Maybe I'll try to extend the xmbc-json plugin to throw an event when something comes in. - MKay - 2010-10-15 topfs2 Wrote:Hmm, I didn't think of your scenario MKay.[...](topfs2 asked me to post my PM here for discussion about solutions To get the currently playing data (e.g. artist and title of a song) i need to get the active player (GetActivePlayers) and then get the playlist's items with GetItems. The result contains a field with the name "current" which is the playlist-entry-index of the currently playing file, right? So when i want to get the artist/title of the currently playing song i can retrieve the playlist's data with GetItems and everything is fine. But when a song is playing (playlist has one entry) and i clear the playlist with AudioPlaylist.Clear then there is no way to get the artist/title of the currently playing file because the GetItems-function of the playlist will return an empty list (as i know). At least this was the case in beta2 ... beta3 not tested yet - Tolriq - 2010-10-15 After some tests i can confirm that System.GetInfoLabels is good for getting currently informations even with empty playlist :p Even permit to send one less request for getting the seekposition See http://wiki.xbmc.org/?title=InfoLabels for list Just a little question not json related but since it have the same effect perhaps topfs have a solution The info label : System.KernelVersion always send busy on the first request need to wait for 300 or 400 ms to retry and get the data (same with httpapi) Not very important but since i use this to check if Yatse connects to the correct machine it's annoying to add delays for nothing |