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
|
- marksoccer - 2010-07-18 Is there a way to play a single song? When I try to use XBMC.Play using a songid, nothing happens. When I looked at the code for XBMC.Play, it didn't look like songids are supported. Is there a workaround to play one song? - topfs2 - 2010-07-18 marksoccer Wrote:Is there a way to get a sorted list of artists based on artist name (rather than artistid) without manually sorting after receiving the json string? I don't have the code atm but you should use sortmethod and sortorder, so it should be something like this Code: { "jsonrpc": "2.0", "method": "AudioLibrary.GetArtists", "params": { "sortmethod": "artist" }, "id": 1 } If you have the code you can check out FileItemHandler for the sorting code, should be in Parsesomething IIRC. marksoccer Wrote:Is there a way to play a single song? When I try to use XBMC.Play using a songid, nothing happens. When I looked at the code for XBMC.Play, it didn't look like songids are supported. Is there a workaround to play one song? Nope, songid's aren't supported and nothing should give you that id even IIRC. You can use the real path though. i.e. XBMC.Play("smb://foo/bar.mp3") - dstruktiv - 2010-07-18 Thanks for the help on getting images via http New question, is there a way to enable more indepth logging on XBMC's end? I'm trying to build a tree view of artists/albums/songs but when I query albums based on artist it ignores the parameters and returns all albums. My app log outputs the JSON as it sends it (+44 is name of artist): Code: 7/18/2010 10:39:41 PM - { And XBMC Log - It doesn't fail to parse it, just seems to ignore the param: Code: 22:39:39 T:1324 M:2024378368 NOTICE: WebServer: POST | /jsonrpc It'd be interesting to see what exactly xbmc is receiving. edit nvm I'm an idiot I needed to pass artistid not name - topfs2 - 2010-07-18 jsonrpc does not support searching (which getting albums based on an artist name is). You need to give GetAlbum an Artist ID. The Artist ID can be gotten from GetArtists. - marksoccer - 2010-07-18 topfs2 Wrote:Nope, songid's aren't supported and nothing should give you that id even IIRC. You can use the real path though. i.e. XBMC.Play("smb://foo/bar.mp3") Hmm. I got songids using AudioLibrary.GetSongs and providing an artistid and albumid. Thanks for the workaround though. - Johnsel - 2010-07-20 Could anyone help me with implementing this in C#? I currently do a WebRequest to the jsonrpc server and i do receive an answer, but how to parse it? I found json .net library (NewtonSoft), but how can i decode the JSON answer to say an array? Or should i parse them manually? - Tolriq - 2010-07-20 Well perhaps just start reading the entire thread But for the moment the best json implementation i found is Jayrock - Johnsel - 2010-07-20 Got it working, couldn't use Jayrock as i need it to be .net Compact compatible. anyways, here's an example for usage with the NewtonSoft Json library maybe it'll help someone else to start Code: //json webrequest - dstruktiv - 2010-07-22 Started coding a .NET library to interface with the JSON-RPC API It's a mess and not everything's implemented but it's a start - Cheers Tolriq for the initial help: http://code.google.com/p/xbmc-json/ - Bram77 - 2010-07-22 dstruktiv Wrote:Started coding a .NET library to interface with the JSON-RPC API Looking great! Nice and clean coding. DO you think you can keep it Mono compatible so it can be used to create Linux/osX clients? - Johnsel - 2010-07-22 goddammit, i just wrote a .net library too Yours is cleaner though - topfs2 - 2010-07-22 marksoccer Wrote:Is there a way to play a single song? When I try to use XBMC.Play using a songid, nothing happens. When I looked at the code for XBMC.Play, it didn't look like songids are supported. Is there a workaround to play one song? I've fixed this now. You have the possibility to use songid when you add, play or whatever you wish to do. Also I've made playlists be more of use, specifically virtual ones. The add of virtual files now is able to add anything xbmc.play is able to take. So this is now possible: playlist-virtual = Playlist.Create(); Playlist.Add(playlist-file = "/foo/bar.m3u", songid = 31, artistid = 1); Playlist.Shuffle(playlist-virtual); XBMC.Play(playlist-virtual); Playlist.Destroy(playlist-virtual); This code would create a virtual one which would have items from the playlistfile, every song from artistid=1 and the songid=31 Hopefully this will help abit. Note that the virtual playlists aren't linked to any client and isn't managed. i.e. it won't be destroyed when a client disconnect but when xbmc quits or destroy is called. Also its possible to share these playlists between clients. After dharma I might look into virtual playlists which either timeout or are tied to a client and add a shareable playlist incase this is something useful? Cheers, Tobias - dstruktiv - 2010-07-23 Bram77 Wrote:Looking great! Nice and clean coding. DO you think you can keep it Mono compatible so it can be used to create Linux/osX clients? Cheers It should be Mono compatible I can't think of any reason why it wouldn't be, but it relies on the Jayrock JSON Lib so if that's not compatible with Mono then but the source is available for that too so we could look at modifying it if need be. Doesn't get much easier than this Code: using System; json rpc and remote comands - noem - 2010-07-23 Hello, Is there any way to do a UP/DOWN PLAY NEXT events thru the json-rpc or do you have to do it by event server ? - dstruktiv - 2010-07-23 noem Wrote:Hello, Yes. AudioPlayer.PlayPause, AudioPlayer.Stop, AudioPlayer.SkipPrevious and AudioPlayer.SkipNext. Also works for VideoPlayer. |