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
|
- el_Paraguayo - 2011-11-28 Jason102 Wrote:Has the functionality of the Files.GetDirectory call changed? I use the call in PseudoTV to get all of the elements in a smart playlist. This no longer works, I only receive an empty list using the daily builds: Montellese Wrote:You were right and I fixed it in this commit. Thanks for the report. Am I missing something here? I'm trying to get the contents of a smart playlist but can't do it with Files.GetDirectory. Using Files.GetDirectory on "special://videoplaylists" correctly lists my smart playlist (xsp) and a static one (m3u). Using GetDirectory on the m3u file lists the files, but doing: Code: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/test.xsp"}, "id": 1} Code: {"id":1,"jsonrpc":"2.0","result":{"files":null,"limits":{"end":0,"start":0,"total":0}}} any help would be greatly appreciated. I'm using the nightly from 26 November. Thanks, el_P - Montellese - 2011-11-28 el_Paraguayo Wrote:Am I missing something here? I'm trying to get the contents of a smart playlist but can't do it with Files.GetDirectory. Have you tried passing the "media" parameter as well? It is required for JSON-RPC to be able to access the correct database (audio or video). So try passing "media": "video" alongside the "directory" parameter and let me know if that fixes your problem. - el_Paraguayo - 2011-11-28 Montellese Wrote:Have you tried passing the "media" parameter as well? It is required for JSON-RPC to be able to access the correct database (audio or video). So try passing "media": "video" alongside the "directory" parameter and let me know if that fixes your problem. Ridiculously fast response Montellese!! Works perfectly, thank you. - Montellese - 2011-11-28 el_Paraguayo Wrote:Ridiculously fast response Montellese!! Glad to hear that. You got lucky I just got the email notification - el_Paraguayo - 2011-11-28 Also meant to ask, is there a "random" sort order? I'm updating a script that plays random movies and, at present, the random selection is done by the Python script which means the entire movie library is loaded into a list and then selects one at random. If the JSON can output a random movie then this would make my job simpler. - jimk72 - 2011-11-29 Quick question: When I was parsing the playlist files and extracting items and sending them to xbmc through json it does not work when I send local files? example: smb://FREENAS/Music/AC_DC/AC_DC Live/Thunderstruck.mp3 adds to playlist fine but local files from a m3u file do not? H:\Music\3 Doors Down\When You're Young\When You're Young.mp3 gives an error about incorrect params? These are both from the same m3u file. Just figured out I can get the files from a playlist through json and local files are as follows: H:\\Music\\3 Doors Down\\When You're Young\\When You're Young.mp3 is this the format I need to send to add local files to playlist? - Montellese - 2011-11-29 el_Paraguayo Wrote:Also meant to ask, is there a "random" sort order? Databases don't support random ordering so XBMC would have to implement it manually is well which means XBMC would have to retrieve all movies as well and then randomly sort them which is almost the same as when you have to do it in your script. - Montellese - 2011-11-29 jimk72 Wrote:Quick question: When I was parsing the playlist files and extracting items and sending them to xbmc through json it does not work when I send local files? The double backslash is needed in JSON because a backslash is an escape character (e.g. to escape double-quotes (") within a string) so you have to escape the backslash with another backslash. If you don't do that the JSON parser tries to interprete \M, \3 and \W (in the specific case of the path you posted) as special characters which will end up with an invalid path. - Tolriq - 2011-11-29 Montellese Wrote:Databases don't support random ordering so XBMC would have to implement it manually is well which means XBMC would have to retrieve all movies as well and then randomly sort them which is almost the same as when you have to do it in your script. SQLLite or Mysql support random sorting very well And both with the same syntax : PHP Code: ORDER BY RAND() - el_Paraguayo - 2011-11-29 Montellese Wrote:Databases don't support random ordering so XBMC would have to implement it manually is well which means XBMC would have to retrieve all movies as well and then randomly sort them which is almost the same as when you have to do it in your script. That's fine. I just wanted to check I wasn't doing something that could be done by adding an extra parameter to my request! - Montellese - 2011-11-29 Tolriq Wrote:SQLLite or Mysql support random sorting very well I didn't mean SQLite or MySQL but our VideoDatabase and MusicDatabase but I can see that my statement was not very well phrased. We don't do the sorting through SQL because in many cases it isn't that easily possible (for example when "ignorearticle" is used) so if we want to provide a random sort we'll have to implement it manually as well. - jimk72 - 2011-11-29 Montellese Wrote:The double backslash is needed in JSON because a backslash is an escape character (e.g. to escape double-quotes (") within a string) so you have to escape the backslash with another backslash. If you don't do that the JSON parser tries to interprete \M, \3 and \W (in the specific case of the path you posted) as special characters which will end up with an invalid path. That was it! All playlists are selectable/viewable and playable now without any custom parsing from remote! I also noticed my smart playlists that have random will return a random order of the selected songs! You guys are doing one hellofa job!! Im amazed at how fast it works. Most playlists are instantly loaded with zero delay. - darwin - 2011-11-30 I'm confused about how to use Player.Open. I checked the wiki but it just says "mixed" for the parameters. I introspected and I saw that there's a path parameter to Player.Open, and I am trying to use it like so.. Code: {"params": {"path": "smb://192.168.0.200/path/to/my/file.avi"}, "jsonrpc": "2.0", "method": "Player.Open"} Doesn't seem to work and doesn't give any JSON response. Also doesn't log anything in the debug log at level 2. Player.Open takes a "path" argument, does that replace the former "file" argument of XBMC.Play? I feel like I'm missing something obvious... EDIT : Hey, jimk72's post below me answers my question! I guess it takes a Playlist.Item object.. which makes sense! yay! - jimk72 - 2011-11-30 Might have bug. If I use {"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"special://profile/playlists/music/playlist.m3u"}},"id":1} It loads into the playlistid 1? the playlist contains only 3 songs. but if I do {"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"special://profile/playlists/music/playlist.xsp"}},"id":1} A smart playlist of only songs, It loads it into playlistid 0. Getplaylists displays: {"id":3,"jsonrpc":"2.0","result":[{"playlistid":0,"type":"audio"},{"playlistid":1,"type":"video"},{"playlistid":2,"type":"picture"}]} Active player returns: {"id":1,"jsonrpc":"2.0","result":[{"playerid":0,"type":"audio"}]} for both of the above. There is no way to tell if playlist 1 or playlist 0 is playing? Which you need to know if you want to use playlist.add - Montellese - 2011-11-30 jimk72 Wrote:Might have bug. It's not really a bug because that's how XBMC works. If it has to create a playlist from multiple files it (by default) creates a video playlist unless there is some specific meta data that can be retrieved that specifies it as a music playlist (which is possible with smart playlists). This logic/implementation is far from perfect and I don't really know why it is done this way but that's how it is. If you want to know the playlistid of the playlist used by a player you can use Player.GetProperties and retrieve the "playlistid" property. |