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
|
- Kabooga - 2010-04-22 Quote:Tolriq Wrote: Blasphemy!!!! - noem - 2010-04-23 Hello All, Im Playing arround with the jsonrpc and I have a question where can I get the parametrs for the functions? ie: Quote:XBMC.SetVolume '{ : 12 }'thx - Bram77 - 2010-04-25 I've started writing a Ajax/jQuery driven web interface today, using the JS library I'm developing. It's just a demo app but it's a lot of fun to write. I wish I could get all data that's updated every second in one request. That would make the code a lot prettier and the app a lot more efficient..... So far I have the Now Playing Audio- and controls part mostly done. There is still a lot of work to do and it doesn't look pretty, but it's a start There some fading and sliding going on you obviously can't see in the screenshot :p Next are... Now Playing Video Now Playing Picture Tabbed media browser (files, libraries, filters); left side Tabbed Media Info and Playlists; right side - noem - 2010-04-25 Can anyone tell me where can I get the jsonrpc method parameters from ? thx - topfs2 - 2010-04-25 Nice bram! Sorry everyone, have had a really hectic week so haven't had time to do much. Hopefully next week will calm down abit but I fear not. noem Wrote:Can anyone tell me where can I get the jsonrpc method parameters from ? JSONRPC.Introspect or point to http://localhost:8080/development.html (should be a tab in the standard webinterface now). - noem - 2010-04-26 topfs2 are you going to include the pvr stuff support also in json ? - spiff - 2010-04-26 certainly not before it's merged to trunk. - Kabooga - 2010-04-27 Does the method "Playlist.Add" have a recursive option like "AddToPlayList" in the original API? - topfs2 - 2010-04-27 Kabooga Wrote:Does the method "Playlist.Add" have a recursive option like "AddToPlayList" in the original API? Not sure how you mean? You can do Playlist.Add(albumid=X) and it will add all that album. However if you call Playlist.Add(file=Y) it will only add that file, not sure how to handle directories yet since it depend on the content so directories haven't been wrapped yet. Or do you mean something that recursively goes down the directory given? - Bram77 - 2010-04-27 Maybe Playlist.Add(directory=Y, media=audio/video) could do the trick. If I remember correctly this is how it's done in the http api. A method like this would be very helpful and reduce overhead. Just as methods to retrieve the state of some elements in XBMC would be, like... I've created a Status namespace in the JS lib for these kind of methods. At this point it contains the available now playing data, playingTime/percentage and the current volume isShuffleEnabled isRepeatEnabled getRepeatMode isPartyModeEnabled isWinding (not shure how to name this in english, return if fastforward or rewind is currently active) isMuted isPaused isAudioPlaying (not really necessary, but useful) isVideoPlaying (not really necessary, but useful) isMediaPlaying (shorthand for "isAudioPlaying || isVideoPlaying" ) isPictureShowing (not really necessary, but useful) ...or whatever naming convention you prefer I haven't been able to retrieve the shares available. Could you point me in the right direction? The audio playlist items only contain labels, file paths and thumbnail paths. Would it be possible to add artist, album, year, time etc... if available? Or do you have an alternate method in mind? edit: To give you an idea about how I think the status data could be updated more efficiently you could take a look at the Status namespace I'm creating for the JS lib. It will probably be devided into / extended with Status.NowPlaying, Status.Controls i.e.. The 'update()' method is executed every second (as often as possible), which results in 5 request to the JSON RPC api at this point. When HTML5 is the standard, I could create a separate thread for the browser to use as a working thread so these requests won't influence the browsers performance. But at this point the requests do slow down the browser significantly. When and if more methods are implemented to retrieve the current element statuses the amount of requests will increase... Creating a method to get all the data in one request would really help with building a solid and reliable client. Keep in mind that JS has very limit OOP possibilities and this is just a mockup. I had to make some methods publicly available to do the things I wanted to do. http://code.google.com/p/xbmcweb/source/browse/trunk/branches/0.2.0/library/xbmc/lib/status.js - Kabooga - 2010-04-27 In response to topfs2 question. Quote:From Wiki on AddToPlaylist API: The recursive ability to add ALL music (or video) files contained in a selected directory (and subdirectories) was very useful. Regards, Kabooga - noem - 2010-04-27 What about interface integration commands ie: the httpapi SendKey function is that also going to be added ? Keep up the grate job you are doing there Im currently developing app based on your framework. and sorry for all the bugging Kind regards noem - Bram77 - 2010-04-28 Today's screenshot... - topfs2 - 2010-04-28 Kabooga Wrote:In response to topfs2 question. Bram77 Wrote:Maybe Playlist.Add(directory=Y, media=audio/video) could do the trick.Sounds like a good plan. Playlist.Add(directory=X, content=Y, recursive=true) Bram77 Wrote:A method like this would be very helpful and reduce overhead. Just as methods to retrieve the state of some elements in XBMC would be, like...You mean Files.GetShares ? Bram77 Wrote:The audio playlist items only contain labels, file paths and thumbnail paths. Would it be possible to add artist, album, year, time etc... if available?Yeah thats abit of a bug now, you should be able to get them API-wise through the same mechanism as with with the library. fields: ["artist", "album", "year"] Bram77 Wrote:edit: To give you an idea about how I think the status data could be updated more efficiently you could take a look at the Status namespace I'm creating for the JS lib. It will probably be devided into / extended with Status.NowPlaying, Status.Controls i.e.. The 'update()' method is executed every second (as often as possible), which results in 5 request to the JSON RPC api at this point. something like Player.GetInfo with the appropriate fields perhaps? noem Wrote:What about interface integration commands ie: the httpapi SendKey function is that also going to be added ?Yeah I will add that at some point, however not at this stage EventServer is better to use for now. The reason for this is that core is abit messy regarding input so to create a good clean API I think core needs to be cleaned up. - Bram77 - 2010-04-28 Quote:something like Player.GetInfo with the appropriate fields perhaps?That sounds like the right place and the right method name . Do you think the current volume percentage would fit in there? Files.Getshares isn't working for me. But I think there is something wrong with the way I use api calls with multiple parameters or one parameter that has a name, because non of these call works. i.e. Code: {"jsonrpc":"2.0","method":"Playlist.Swap","params":{"playlist":"music","item1":2,"item2":1},"id":1} Code: {"jsonrpc":"2.0","method":"Playlist.Remove","params":{"playlist":"music","item":3},"id":1} |