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
|
Sorting on GetAlbums, GetArtists - ncarthy - 2011-01-13 I had also noticed that GetAlbums does the limit first, then the sorting. That is to say, if you specify start 0 and end 10 with sort ascending then it returns the first 10 albums it finds in the database and then sorts them. Those 10 albums are sorted by albumid I think. This behaviour can be demonstrated by doing a second query with a start of 10, end of 20 and comparing the results. It won't be the next 10 albums in alphabetical order. GetArtists does it correctly, but at the very high cost of querying the database for ALL artists, then sorting and applying the limit. Neither way is right... in an ideal world the sorting/limiting should be done by the database, not the libjson code. But that would require changes to the database code, outside of libjsonrpc. This also leads to an inconsistency in the "total" parameter returned by libjsonrpc: For GetAlbums with start 0 and end 10 it will return 10, for GetArtists it will return the number of Artists in the database. I opened a Trac ticket for the totals problem in September (http://trac.xbmc.org/ticket/10146) - litemotiv - 2011-01-13 ncarthy Wrote:I had also noticed that GetAlbums does the limit first, then the sorting. That is to say, if you specify start 0 and end 10 with sort ascending then it returns the first 10 albums it finds in the database and then sorts them. Those 10 albums are sorted by albumid I think. This behaviour can be demonstrated by doing a second query with a start of 10, end of 20 and comparing the results. It won't be the next 10 albums in alphabetical order. Hmm well, 'ideal world' is not really appropriate i think, this is all sql-101. Select A, B from table C order by D limit x,y - ncarthy - 2011-01-13 Problem is that current coding guidelines do not allow ad hoc sql requests... you must go through the interface exposed by the musicdatabase object. I don't think there's a suitable method or if there is it's not being used. My workaround was to load all the albums into memory and do my own sorting/limiting. - litemotiv - 2011-01-13 ncarthy Wrote:My workaround was to load all the albums into memory and do my own sorting/limiting. Yes, that's not really an option for me, since it takes ages to parse on a mobile phone... - vinc - 2011-01-14 Is there any way to get library information from a tv-show episode or movie? Stuff like plot, release year, rating etc.? Can't find the right method to call and "VideoLibrary.GetMovieInfo" seems to be deprecated? - Montellese - 2011-01-14 vinc Wrote:Is there any way to get library information from a tv-show episode or movie? Stuff like plot, release year, rating etc.? Can't find the right method to call and "VideoLibrary.GetMovieInfo" seems to be deprecated? You need to use the "VideoLibrary.GetMovies" method and provide an array of all the fields you want. (AFAIK) Possible field values for movies are: Code: "title", "genre", "year", "rating", "director", "file", "trailer", "tagline", "plot", "plotoutline", "originaltitle", "lastplayed", "duration", "playcount", "writer", "studio", "mpaa", "movieid" - vinc - 2011-01-14 Montellese Wrote:You need to use the "VideoLibrary.GetMovies" method and provide an array of all the fields you want. (AFAIK) Possible field values for movies are: Ah great! Thanks! The wiki didn't make clear you can use GetMovies for this! - vinc - 2011-01-15 Montellese Wrote:You need to use the "VideoLibrary.GetMovies" method and provide an array of all the fields you want. (AFAIK) Possible field values for movies are: I think I didn't explain good enough what I wanted to do; I want to query the information for a SINGLE movie of tvshow, should I be using the above method? I can't seem to get it working. - wuench - 2011-01-15 So I get that I can get the fanart, thumbnail, etc locations with VideoPlaylist.GetItems. Is there a method to retrieve JPG's from the HTTP interface using the special:// URLs it returns? - Montellese - 2011-01-15 vinc Wrote:I think I didn't explain good enough what I wanted to do; I want to query the information for a SINGLE movie of tvshow, should I be using the above method? I can't seem to get it working.Ah sorry misunderstood you there. Dharma does not contain methods to get the details of a single movie/episode/song but such methods are already implemented in the current development source code. wuench Wrote:So I get that I can get the fanart, thumbnail, etc locations with VideoPlaylist.GetItems.Do you want to know how you can download files from the paths provided by the json rpc responses? If so give "Files.Download" a try. It takes an xbmc-specific path and returns an URL from where you can download the specified file. - wuench - 2011-01-15 Montellese Wrote:Ah sorry misunderstood you there. Dharma does not contain methods to get the details of a single movie/episode/song but such methods are already implemented in the current development source code. I am writing a driver for CharmedQuark(CQC) and I don't have access to decode image data so Files.Download won't work for me. I was looking for a way to get the actual JPG served by the web interface and I think I found it by decoding the Javascript in the web interface. Glad that is using the JSON commands, it provides some pretty good examples if you can read JQuery. So to access a special:// URI you just use: Code: Usage: - Xedar - 2011-01-19 Hi! is there a way to get the id tag in every { } ? when i parse the JSON i must use an } as EOM otherwise iam not able to fetch everything. eg. Code: { it would be great to have the Code: "id" : 50, I match with regex eg. Movies Code: "id" : 50,.*[\r\n\w]+"file" : "(.*)",.*[\r\n\w]+"label" : "(.*)", Code: "id" : 40,.*[\r\n\w]+"file" : "(.*)",.*[\r\n\w]+"label" : "(.*)", Best regards Mikael - Montellese - 2011-01-19 I'm not sure I understand what you want. The "id" tag should be used to match a response from XBMC to a request you sent yourself. Furthermore if you get a json object without an "id" tag it indicates that you received an announcement and not a response. If you write your own parser you should basically count the number of { and } to determine the end of a message. And you should use a json library which can read a json object and detect the available fields and their values and not use regular expressions because there are alot of different response objects and I don't think you would want to write regex's for all of them. - Xedar - 2011-01-19 Montellese Wrote:I'm not sure I understand what you want. The "id" tag should be used to match a response from XBMC to a request you sent yourself. Furthermore if you get a json object without an "id" tag it indicates that you received an announcement and not a response. Hi Montellese I want the "id", alot of them! in every { } like this Code: { Problem is iam limited to none JSON, i send request to raw TCP and match with regex. We use Iviewer for Ipad http://www.commandfusion.com/ right now I do it ugly, matching the "movieid" field instead of id # for movies and yes regex can be a pain when parsing alot... I can understand its not a good feature to change standard JSON outputs. Best regards. - topfs2 - 2011-01-19 Xedar Wrote:Hi Montellese Not in jsonrpc 2.0 spec, not happening. You know you can save the ID variable somewhere in the memory when you parse down the tree... |