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
|
- carmenm - 2011-04-06 topfs2 Wrote:I say put a ticket on this, we should notify on window change no matter and we could probably notify on player going to from fullscreen also, I agree its a nice state to track. For sure a good idea to have remotes look different when in fullscreen and when in GUI, so whatever makes that easier is good I love that kind of answer and i completely agree with you on remotes. That s the whole point of the app i am developing. By the way if we have an announcement we also need a function to get the state. EDIT : added - carmenm - 2011-04-06 still on my request frenzy: - would it be possible to query date Added as a field? I know we can get recently added, but having a date added would allow to sort that way. Yet i dont know if that s even possible on XMBC's side. Thanks - Montellese - 2011-04-06 jitterjames Wrote:yes, but audioplaylist.add only appears to allow us to add a single item, So how would we add You should be able to use AudioLibrary.GetArtists() to get a list of all artists, then choose artist "xyz" and remember his artistid and then do AudioPlaylist.Add using that artistid in the correct parameter. - topfs2 - 2011-04-06 carmenm Wrote:still on my request frenzy: IIRC this is not possible on xbmc side, we don't store it. However I see no reason at all why we shouldn't so feel free to suggest it along with the sort option for it. That way we can remove the recently added method and just use the normal getters for the same effect. - carmenm - 2011-04-06 topfs2 Wrote:IIRC this is not possible on xbmc side, we don't store it. However I see no reason at all why we shouldn't so feel free to suggest it along with the sort option for it. That way we can remove the recently added method and just use the normal getters for the same effect. once again i completely agree. i am adding a feature request in database component. - marksoccer - 2011-04-06 Montellese Wrote:I removed all the parameters which caused some problems or didn't always work properly. If I have the time to fix them the parameters will be re-added. Sorry, I should have mentioned, I tried using AudioPlaylist.Play after using AudioPlaylist.Add (also tried after AudioPlaylist.Insert). I should note however, that AudioPlaylist.Play appears to be working fine as I can play something through the XBMC GUI and have it restart to the top of the playlist using AudioPlaylist.Play. However, regardless of whether I use Add or Insert, I cannot get items (songids, albumids, artistids) to be added to the now playing queue. Here are some examples of the commands I am sending, and their respective results: Using Insert: {"jsonrpc":"2.0","method":"AudioPlaylist.Insert","id":1,"params":{"item":{"artistid":89},"index":0}} {"jsonrpc":"2.0","method":"AudioPlaylist.Play","id":2,"params":{"item":0}} Result[1] = {"id":1,"jsonrpc":"2.0","result":"OK"} Result[2] = {"id":2,"jsonrpc":"2.0","result":{"success":true}} Using Add: {"jsonrpc":"2.0","method":"AudioPlaylist.Add","id":1,"params":{"item":{"artistid":89}}} {"jsonrpc":"2.0","method":"AudioPlaylist.Play","id":2,"params":{"item":0}} Result[1] = {"id":1,"jsonrpc":"2.0","result":"OK"} Result[2] = {"id":2,"jsonrpc":"2.0","result":{"success":true}} - Montellese - 2011-04-06 marksoccer Wrote:Sorry, I should have mentioned, I tried using AudioPlaylist.Play after using AudioPlaylist.Add (also tried after AudioPlaylist.Insert). No problem I thought as much but just wanted to be sure. I'll have to double-check that because I didn't touch the logic behind it I only re-structured the parameters. - marksoccer - 2011-04-07 Montellese Wrote:No problem I thought as much but just wanted to be sure. I'll have to double-check that because I didn't touch the logic behind it I only re-structured the parameters. I think I have discovered the problem. It appears that the parameterObject being passed into CAudioLibrary::FillFileItemList is the "parameters" object rather than the newly created "item" object. I tried to find the simplest fix, which I determined was to change parameterObject to parameterObject["item"] in AVPlaylistOperations.cpp before passing it into FillFileItemList. I'm not sure whether this is the best fix (it might break other stuff), but it solves the problem I was having. - marksoccer - 2011-04-07 Also, can you explain what you mean by: Quote:It is now possible to send multiple calls in a single request and receive all the responses in a single response. This can result in less data traffic and faster responses over HTTP An example of a multi-command json string would be much appreciated - Montellese - 2011-04-07 marksoccer Wrote:I think I have discovered the problem. It appears that the parameterObject being passed into CAudioLibrary::FillFileItemList is the "parameters" object rather than the newly created "item" object. I tried to find the simplest fix, which I determined was to change parameterObject to parameterObject["item"] in AVPlaylistOperations.cpp before passing it into FillFileItemList. I'm not sure whether this is the best fix (it might break other stuff), but it solves the problem I was having.Thanks for taking a look at this. I will take a stab at it later today. marksoccer Wrote:An example of a multi-command json string would be much appreciated There's nothing special about json-rpc's batch requests. It's simply a queuing of multiple requests like this: Code: [{ "jsonrpc": "2.0" method: "AudioPlayer.Add", "params": { ... }, "id": 1 }, You can put together as many requests as you like. Obviously this makes no difference over TCP but over HTTP you will get the responses of all three requests from the above example in a single HTTP Response packet. Furthermore you can drop the "id" parameter on the first two requests and therefore making it into notifications which do not generate a response at all and you will only get the response for the call to "AudioPlayer.GetItems". Obviously you will miss any errors happening during the requests you send as notifications. EDIT: Forgot to mention that batch requests need to be transfered in an array so you'll have to put [ ] around the requests and a comma as a seperator between requests. - Montellese - 2011-04-07 marksoccer Wrote:Sorry, I should have mentioned, I tried using AudioPlaylist.Play after using AudioPlaylist.Add (also tried after AudioPlaylist.Insert). Thanks again for the report. You were right about the "item" and I fixed it in https://github.com/xbmc/xbmc/commit/db9d7e5fd4b15fda5f7539e9f40def063fd7af05. Please report back whether it works for you as well (I tested it for artistid and albumid). XBMC.Play ? - noem - 2011-04-11 I just tried to do an XBMC.Play with a movieid Code: {"method":"XBMC.Play","id":23,"jsonrpc":"2.0","params":{"movieid":222}} responce: Code: { this works fine: Code: {"method":"XBMC.Play","id":23,"jsonrpc":"2.0","params":{"file":"the\file\path"}} BTW love the RPC changes Kind Regards! - Montellese - 2011-04-12 noem Wrote:but when you start a playback of a file you dont get any info like movieid/thumbnail/fanart in playlist .... How to play a movieid ? or an artist/albumid ? You can use AudioPlaylist.Add() or VideoPlaylist.Add() and then XXXPlaylist.Play(). Both Add() methods take a parameter "item" with a respective property (artistid, albumid, movieid, ...). Hope that helps. - noem - 2011-04-12 I'd like to mention that correct invocation of AudioPlaylist.Add requires non-valid JSON string: Code: {"jsonrpc":"2.0","method":"AudioPlaylist.Add","id" :1,"params":{"item":{"artistid":89},"item":{"artistid":80}}} therefore, it should be something like: Code: {"jsonrpc":"2.0","method":"AudioPlaylist.Add","id" :1,"params":{"item":[{"artistid":89},{"artistid":80}]}} Regards - Montellese - 2011-04-12 noem Wrote:I'd like to mention that correct invocation of AudioPlaylist.Add requires non-valid JSON string: The first example is a non-valid JSON string because the second "item" property of "params" overwrites the first one. There is no way of getting both artistid's if you provide such a JSON string. Furthermore there is no support in AudioPlaylist.Add to provide multiple artistid's or albumid's or whatever right now so there is nothing wrong with how you have to provide the parameters as it is not a supported feature. You can only define one "item" object right now. |