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
|
- Montellese - 2011-10-23 carmenm Wrote:Actually what bugs me most is that the response doesnt follow xbmc json specification. Especially i dont get a "failure" field(which i rely on just to know that XBMC answered correctly).Why do you expect a "failure" field? First of all I have never heard of a "failure" field in JSON-RPC and second of all your request didn't fail. If no player is playing, that is not an error so an empty array will be returned. I just tested it on my dev machine and if I'm watching a movie I get Code: { Code: { - carmenm - 2011-10-23 I assure you there was a "failure" in XBMC JSON RPC before. My app was working and i wasnt stoned ( at least i hope so ) So i ll update it taking in account it s not there anymore. Thanks for the feedback. - topfs2 - 2011-10-23 carmenm Wrote:Actually what bugs me most is that the response doesnt follow xbmc json specification. Especially i dont get a "failure" field(which i rely on just to know that XBMC answered correctly). While as montellese states that the response is meant to be either an array of items or the empty array you _always_ need to be aware that methods can fail. Many methods may fail to execute (a specific jsonrpc error) for various reasons, this is something all clients need to check against and be aware of. While xbmc in general might not fail to execute new servers might (as they might not have implemented all in the API). For example Player.Pause may fail to execute, its within the spec. - carmenm - 2011-10-23 topfs2 Wrote:While as montellese states that the response is meant to be either an array of items or the empty array you _always_ need to be aware that methods can fail. I am sorry but i am not sure i get your point. Does it mean there WAS a failure field? I mean how can a client check the success of a jsonrpc if not with a success/failure field? - topfs2 - 2011-10-23 carmenm Wrote:I am sorry but i am not sure i get your point. Check jsonrpc 2.0 specification, errors are defined there. - jasonvp - 2011-10-24 Hi guys, Is there a method for retrieving the location and items of Saved Playlists and Party Mode Playlists? Cheers Jason - Montellese - 2011-10-24 Saved playlists aren't exposed yet but I have already considered something like FooLibrary.GetPlaylists which could be added after Eden has been released. As soon as we have the Playlist.Create/Load/Destroy/Unload functionality such methods make sense because they will allow to load those playlists into a playlist manageable through jsonrpc. I think this feature request covers your question? If you have something to add to the ticket, feel free to do so. Any input is welcome. - jasonvp - 2011-10-24 Montellese Wrote:I think this feature request covers your question? If you have something to add to the ticket, feel free to do so. Any input is welcome. What about adding Favourites to the Ticket or should this be in a new Feature Request Ticket? - Montellese - 2011-10-24 Does Favourites have anything to do with Playlists? I don't think so, so a new feature request ticket is better. - jasonvp - 2011-10-24 Montellese Wrote:Does Favourites have anything to do with Playlists? I don't think so, so a new feature request ticket is better. Yeah your right. Sorry wasn't thinking. - frolick - 2011-10-26 Howdy, I have question about the Files.GetDirectory call. One of my smb sources is set up like: Code: smb://user:pswd@ipaddress/folder/share If I make the following call: Code: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params" : { "directory" : "smb://ipaddress/folder/share/", "media" : "video", "sort": { "order": "ascending", "method": "file" } }, "id": 1} JSON RPC responds with a "Invalid params" error but if I make the same call with the host name of the computer substituted for the IP like below then everything works correctly and I get a list of what's in that directory. Code: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params" : { "directory" : "smb://hostname/folder/share/", "media" : "video", "sort": { "order": "ascending", "method": "file" } }, "id": 1} I know the simple solution is just to use the hostname instead of the IP in the sources list but I was wondering if Files.GetDirectory was supposed to work with IPs in the directory field or if it just accepts a string with the folder name. I'm testing on an ATV2 running the 20111024-c5758bf nightly. Thanks! Edit: Nevermind. It works if I use smb://user:pswd@ipaddress/folder/share/. I haven't looked into it yet, but is there a way that I'm not seeing to get the full folder location (with user/pswd) from Files.GetSources? Time to call JSONRPC.Introspect - jimk72 - 2011-10-26 Ok I have my program recieving json now so I am making big jumps. I am having problems with two things. Where do I figure out the params? I am trying to do Player.open and send a movie from the library json the movieid is 4. I see how to do a playlist item and an actual file but not a library item. When I looked all it says is it can do a playlist, file, picture folder, or database item. I seem to be missing the list of objects and items that are avail to pass as a param. The second thing is getting the thumbnail images from xbmc. I know how to call for them and get the location but what method are you guys using to download the images to display in your app and what format are they in? PNG? Thanks for all the help so far! jimk - Montellese - 2011-10-26 frolick Wrote:Howdy,There's no other method of retrieving sources apart from Files.GetSources. I'll have to investigate myself why XBMC doesn't return the path with username and password but maybe it's a "security feature". I'll let you know once I found out what's going on. jimk72 Wrote:Ok I have my program recieving json now so I am making big jumps. I am having problems with two things.You call JSONRPC.Introspect to get a fully blown documentation of all the methods and parameters available. In case of starting a movie you would call Code: { "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "movieid": 4 } }, "id": 1 } jimk72 Wrote:The second thing is getting the thumbnail images from xbmc. I know how to call for them and get the location but what method are you guys using to download the images to display in your app and what format are they in? PNG?That depends on what transport you are using? Are you using HTTP or TCP? Only HTTP supports file downloads so far. As I just updated the JSON-RPC wiki page you can take a look there to get more detailed information: http://wiki.xbmc.org/index.php?title=JSON_RPC#Comparison If you use HTTP you call Files.PrepareDownload with the path to the file you'd like to download and then call http://<your-ip>:<your-port>/<path from Files.PrepareDownload> to actually download the file. - Montellese - 2011-10-26 frolick Wrote:Howdy, OK I found out that returning source paths without the credentials (username/password) is a security feature. But that doesn't explain why the call to Files.GetDirectory with the ip-based smb path doesn't work. Could you please check the passwords.xml file in your XBMC userdata profiles directory and see if the credentials are stored in there and whether they are stored for the ip-based SMB path or for the hostname-based path? - jasonvp - 2011-10-26 Hi guys, Would it be possible to have a search method? E.G. Search and return only songs or what ever that start with the letter A, B, or C etc or word. Like the Search feature in the GUI or is this not possible with json? Cheers Jason |