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
|
- wuench - 2011-12-06 Trying to convert my code over to Pre-Eden. When I try to submit the following command: {"jsonrpc":"2.0","method":"XBMC.GetInfoLabels","params":["System.CurrentControl"],"id":1} I get back an error: {"error":{"code":-32602,"data":{"method":"XBMC.GetInfoLabels","stack":{"message":"Invalid type string received","name":"labels","type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"} I can't make heads or tails out what this is trying to tell me. Is it saying the info label "System.CurrentControl" is not supported. If not, is there a list of which infolabels are supported? I get that infolabels are deperecated, but I am more trying to figure out how to read the new docs and what array [1...x] means and the JSON schema stuff. Debugging my code, one command at a time. Some examples in the docs would be really helpful. - Montellese - 2011-12-06 The most important thing the doc tells you is that XBMC.GetInfoLabels takes a parameter named "labels" (http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v3#XBMC.GetInfoLabels) which is not present in your request. So you're request should look like this: Code: {"jsonrpc":"2.0","method":"XBMC.GetInfoLabels","pa rams":{ "labels": ["System.CurrentControl"] },"id":1} The reason why the error message tells you that it received a string but expected an array is because it thinks you are using JSON-RPC's by position notation i.e. the parameters are not provided by their names (in this case e.g. "labels") but by their position (i.e. "params" is an array and not an object) and so XBMC thinks that "System.CurrentControl" is your first parameter. Taking a look at both the JSON-RPC 2.0 specification and the JSON schema draft help a lot in understanding the docs. BTW [1..x] means that the array must contain at least 1 item but can contain as many items as you want. Alternatives would be [] which means the array can take 0 to infinite items or [0..5] which means the array can take 0 to 5 items and so on. - wuench - 2011-12-06 Yep, that worked. Thanks. I read those docs, but it's just not quite sinking in yet... So there may be more dumb questions coming... Slideshow - vasikgreif - 2011-12-09 Hi, how are picture playlists supposed to work?Do they have it's own id and how can I start slideshow? I tried adding the picture as: Code: {"id":50,"jsonrpc":"2.0","method":"Playlist.Add","params":{"playlistid":1,"item":{"file":"smb://192.168.1.109/filestore/1.jpg"}}} Thanks Vasik - Montellese - 2011-12-09 You can either use Player.Open and pass a path to a directory with pictures in the "path" property of the "item" parameter (And optionaly specify "random" and "recursive" as well) or you can add pictures with Playlist.Add to the playlist with ID 3 (this is how it is right now but might change in the future but Playlist.GetPlaylists will tell you the available playlists, their type and ID) and then use Player.Open and pass the "playlistid" 3 in the "item" parameter. - vasikgreif - 2011-12-09 Thanks, I tried that now, but I get: Code: {"error":{"code":-32602,"data":{"method":"Playlist.Add","stack":{"message":"Value between 0 (inclusive) and 2 (inclusive) expected but 3 received","name":"playlistid","type":"integer"}},"message":"Invalid params."},"id":50,"jsonrpc":"2.0"} - Montellese - 2011-12-09 Sorry my bad. The correct playlistid is 2 (see Playlist.GetPlaylists). - vasikgreif - 2011-12-09 Montellese Wrote:Sorry my bad. The correct playlistid is 2 (see Playlist.GetPlaylists). Works great, thanks! - Mizaki - 2011-12-18 A couple of questions on Files.GetDirectory: 1: I was expecting by specifying media:music that I would only get music files returned but I get the directory names. The folder has only directories with the albums names. Am I just misunderstanding what media:music does? Code: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params" : { "directory" : "/audio/artist/", "media" : "music", "sort": { "order": "ascending", "method": "file" } }, "id": 1} 2: I have a smart playlist that returns all the albums from an artist randomly. Albumid is empty. Is that expected? Code: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/music/artist.xsp", "media": "music", "properties": ["albumid", "artistid"]}, "id": 1} Thanks. - Montellese - 2011-12-18 Mizaki Wrote:A couple of questions on Files.GetDirectory:Directories are always returned independant of what you pass in the "media" parameter. Otherwise we wouldn't be able to return directories at all because depending on your definition of "files" a directory is not a file either. But as every returned item has a "type" property it should be easy for you to just ignore all the items with "type": "directory". Mizaki Wrote:2: I have a smart playlist that returns all the albums from an artist randomly. Albumid is empty. Is that expected? "albumid" should be returned but as I never used smartplaylists so far I never tested it either. Please create a bug report on trac. Thanks. - Mizaki - 2011-12-18 Okay, thanks. http://trac.xbmc.org/ticket/12297 - Mizaki - 2011-12-20 I see you've put a fix in for id. I've not tried it yet but I have another query with files.getdirectory. It lists m3u (and I guess all playlists) as a directory. Which is quite useful. However this means that if I use something like: Code: {"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"item": {"directory": "playlist.m3u"}, "playlistid": 0}, "id": 1} - vasikgreif - 2011-12-20 Speaking of Files.GetDirectory, it still returns directories only, not the files. Anyone having similar problem, or was it fixed during last days? (I'm on two weeks old nightly)... Thanks Vasik - Montellese - 2011-12-20 Mizaki Wrote:I see you've put a fix in for id. I've not tried it yet but I have another query with files.getdirectory.I'll have to take a look at such a special case. I don't use any m3u (or other) playlists so I don't have any specific expectations of what should happen in the case you describe. Generally Playlist.Add does not act recursively on directories but then again an m3u playlist is "just" a file and when it is added to a playlist in XBMC it is automatically expanded to all the tracks it contains. vasikgreif Wrote:Speaking of Files.GetDirectory, it still returns directories only, not the files. Anyone having similar problem, or was it fixed during last days? (I'm on two weeks old nightly)... Uhm Files.GetDirectory is returning directories AND files for me and I didn't do any fundamental changes to it for quite a while (only fixed the bug reported by Mizaki) so please provide specific details on what is not working including your JSON-RPC request, the result and what you would expect to be present in the response. - Mizaki - 2011-12-20 It may seem like a bit of a silly question as getdir reports it as a dir so, why wouldn't playlist.add treat it as such but, like you say it is just a file. I'm wondering if the type shouldn't be "playlist" or some such but then I suppose that'll take you down the playlist support that will come after Eden. |