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
|
RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-08-25 I get: Code: "error": { RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-08-25 Wow that was one ugly bug (or rather bad logic in my brain). Thanks for finding and reporting this before the functionality was merged. Should be fixed now (and rebased onto latest master) in my branch and therefore in the PR. RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-08-26 I can't fault you for any bad logic mistakes. I can't even think of a viable way to implement the filter RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Jasp - 2012-08-26 Just wondering if you will provide direct links like Input.Home to Videos, Movies, TV Shows, Music, Weather, Pictures and Programs. Would come in quite handy when jumping from one medium to another. RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-08-26 Okay, I don't get an error any more with this filter but I also get zero results. I've gone over it quite a few times in my head and I think it's right. Code: { "filter": { Title starts with "v" and ends with "d" or Genre is "drama" or "comedy" I'm targeting tv show called "Vexed" with "drama" and "comedy" as genres. You may tell me to "go away" and it may be it was the only way to do it within the JSON schema but couldn't the logic operators go between? I'm thinking more maths like (not that I'm great at that either). This may not work either logically but something like: Code: { "filter": { [ {"field": "title", "operator": "startswith": "v"}, "and": {"field": "title", "operator": "endswith": "d"} ] "or": [ {"field": "genre", "operator": "is", "value": "drama"}, "or": {"field": "genre", "operator": "is", "value": "comedy"} ] } I believe that is the same as the example above. I realise it's quite the PITA already and may not even be possible but I think it's easier to read and easier to generate. I'll go hide now RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-26 (2012-08-26, 16:46)Mizaki Wrote: From a logical point of view this means : I want : - Genre is drama And - Genre is comedy And (Here you put an or with only one choice so is an and) And - Title start with v And - Title end with d This : Quote:Title starts with "v" and ends with "d" Should be written Code: { "filter": { RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-08-26 Thanks for that. I think I was concentrating on the PR example and tying myself up. Now I just need to figure a way out to present and build Re: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-27 It would be awsome if File.GetDirectory could return the watched status for video entries. Is this something that will be added? RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-08-27 This is actually already possible. Make sure you set media = video and not media = file Code: curl -H "Content-Type: application/json" -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"/media/Media/Movies/2 days in Paris\",\"media\":\"video\",\"properties\":[\"title\",\"thumbnail\", \"playcount\"],\"sort\":{\"method\":\"label\",\"order\":\"ascending\"}}}" http://10.0.0.236:8080/jsonrpc | python -mjson.tool Re: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-27 Excellent! Thanks! RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-28 I'm using the same Files.GetDirectory call for music, video and pictures. I would like to sort on multiple fields. If the 'track' field is available I want to sort on that, if the 'episode' field is available I would like to sort on that and in all other cases I want to sort on 'label'. I tried adding a Array in the sort method ("method":["track", "episode", "label"]). But that's not a valid request. Is there any other way to do this? I could create specific parameters for each media type. But I can only distinguish between movies and episodes after the call. So I don't see any other solution then to re-sort the result client side after analyzing it, at the moment, which I'd rather not do since that's quite expensive on a phone. Is there a way to do this in the call that I'm not seeing? RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-28 (2012-08-27, 20:46)Millencolin007 Wrote: This is actually already possible. Make sure you set media = video and not media = file Is it possible to do the same on directory level (with Files.GetDirectory)? RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-08-28 (2012-08-28, 01:16)Bram77 Wrote: I'm using the same Files.GetDirectory call for music, video and pictures. I would like to sort on multiple fields. If the 'track' field is available I want to sort on that, if the 'episode' field is available I would like to sort on that and in all other cases I want to sort on 'label'. I tried adding a Array in the sort method ("method":["track", "episode", "label"]). But that's not a valid request. Is there any other way to do this? Looking at the json schema I think only one sort method is allowed. And sorting on client side is probably faster than fetching the directory a second time with the proper sort order Code: "List.Sort" : { (2012-08-28, 01:52)Bram77 Wrote:(2012-08-27, 20:46)Millencolin007 Wrote: This is actually already possible. Make sure you set media = video and not media = file "/media/Media/Movies/2 days in Paris" is a directory, therefore it works on directory level RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Jasp - 2012-08-28 (2012-08-26, 07:48)Jasp Wrote: Just wondering if you will provide direct links like Input.Home to Videos, Movies, TV Shows, Music, Weather, Pictures and Programs. I think this got lost in the large posts regarding filtering and sorting.... I'm hoping.... (with fingers crossed) that something similar to the current ActivateWindow() could be implemented. Perhaps an Input.Movies.Titles - Input.Movies.Genres - Input.Music.Songs - Input.Music.Artists - Input.Music.Albums - Input.Weather etc RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-28 @Millencolin007 Thanks again . Of course I'd already looked at the official documentation. I thought that maybe there was a workaround that doesn't show in the docs. I guess I'll have to get creative to distinguish between movies and tv shows. Quote:"/media/Media/Movies/2 days in Paris" is a directory, therefore it works on directory level This does work for movies, but TV show root and season directories don't have a playcount param. So to determine if a show has no unwatched episodes I'd have to do at least two more request. Let's say the TVshow root is "Dexter". To figure out if "Dexter" has unwatched episode I'd have to request it's directory content which would result in "Season 1, Season 2, etc.". Every seasons directory content would have to be fetched and analysed too, to conclude if the "Dexter" directory contains unwatched items. I realize now that I haven't checked if the "Dexter" directory also contains a tvshow ID which I could use to request all TV show data including the number of unwachted episodes. I'm going to check that first . To clarify... I'm developing a new Android remote. I don't want to implement library mode, relying on Files.GetDirectory only) because I think it's to confusing for a lot of users to have both file and library mode. Files.GetDirectory offers a very nice middle ground by returning library data where available and file/directory data if an item has not been imported to the database. Unfortunately not all data I need is available (yet :-)). I will use the library options to fetch media meta-data (on request). |