Commit | Line | Data |
---|---|---|
460b9539 | 1 | .\" |
964e027d | 2 | .\" Copyright (C) 2004-2008 Richard Kettlewell |
460b9539 | 3 | .\" |
e7eb3a27 | 4 | .\" This program is free software: you can redistribute it and/or modify |
460b9539 | 5 | .\" it under the terms of the GNU General Public License as published by |
e7eb3a27 | 6 | .\" the Free Software Foundation, either version 3 of the License, or |
460b9539 | 7 | .\" (at your option) any later version. |
e7eb3a27 RK |
8 | .\" |
9 | .\" This program is distributed in the hope that it will be useful, | |
10 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | .\" GNU General Public License for more details. | |
13 | .\" | |
460b9539 | 14 | .\" You should have received a copy of the GNU General Public License |
e7eb3a27 | 15 | .\" along with this program. If not, see <http://www.gnu.org/licenses/>. |
460b9539 | 16 | .\" |
17 | .TH disorder_protocol 5 | |
18 | .SH NAME | |
19 | disorder_protocol \- DisOrder communication protocol | |
20 | .SH DESCRIPTION | |
21 | The DisOrder client and server communicate via the protocol described | |
22 | in this man page. | |
23 | .PP | |
c0c23a60 RK |
24 | The protocol is liable to change without notice. |
25 | You are recommended to check the implementation before believing this document. | |
460b9539 | 26 | .SH "GENERAL SYNTAX" |
c0c23a60 RK |
27 | Everything is encoded using UTF-8. |
28 | See | |
f9635e06 RK |
29 | .B "CHARACTER ENCODING" |
30 | below for more detail on character encoding issues. | |
460b9539 | 31 | .PP |
f9635e06 RK |
32 | Commands and responses consist of a line perhaps followed (depending on the |
33 | command or response) by a body. | |
460b9539 | 34 | .PP |
35 | The line syntax is the same as described in \fBdisorder_config\fR(5) except | |
36 | that comments are prohibited. | |
37 | .PP | |
38 | Bodies borrow their syntax from RFC821; they consist of zero or more ordinary | |
39 | lines, with any initial full stop doubled up, and are terminated by a line | |
40 | consisting of a full stop and a line feed. | |
fc80bbcd RK |
41 | .PP |
42 | Commands only have a body if explicitly stated below. | |
43 | If they do have a body then the body should always be sent immediately; | |
44 | unlike (for instance) the SMTP "DATA" command there is no intermediate step | |
45 | where the server asks for the body to be sent. | |
46 | .PP | |
47 | Replies also only have a body if stated below. | |
48 | The presence of a reply body can always be inferred from the response code; | |
49 | if the last digit is a 3 then a body is present, otherwise it is not. | |
460b9539 | 50 | .SH COMMANDS |
51 | Commands always have a command name as the first field of the line; responses | |
c0c23a60 RK |
52 | always have a 3-digit response code as the first field. |
53 | See below for more details about this field. | |
460b9539 | 54 | .PP |
55 | All commands require the connection to have been already authenticated unless | |
c0c23a60 RK |
56 | stated otherwise. |
57 | If not stated otherwise, the \fBread\fR right is sufficient to execute | |
58 | the command. | |
460b9539 | 59 | .TP |
0f55e905 | 60 | .B adduser \fIUSERNAME PASSWORD \fR[\fIRIGHTS\fR] |
c0c23a60 RK |
61 | Create a new user with the given username and password. |
62 | The new user's rights list can be specified; if it is not | |
63 | then the \fBdefault_rights\fR setting applies instead. | |
64 | Requires the \fBadmin\fR right, and only works on local | |
0f55e905 | 65 | connections. |
eb5dc014 | 66 | .TP |
d42e98ca RK |
67 | .B adopt \fIID\fR |
68 | Adopts a randomly picked track, leaving it in a similar state to if it was | |
69 | picked by this user. Requires the \fBplay\fR right. | |
70 | .TP | |
460b9539 | 71 | .B allfiles \fIDIRECTORY\fR [\fIREGEXP\fR] |
5818980a | 72 | List all the files and directories in \fIDIRECTORY\fR in a response body. |
460b9539 | 73 | If \fIREGEXP\fR is present only matching files and directories are returned. |
74 | .TP | |
ba39faf6 | 75 | .B confirm \fICONFIRMATION |
c0c23a60 RK |
76 | Confirm user registration. |
77 | \fICONFIRMATION\fR is as returned from \fBregister\fR below. | |
78 | This command can be used without logging in. | |
ba39faf6 | 79 | .TP |
eb5dc014 | 80 | .B cookie \fICOOKIE |
0d350ff0 | 81 | Log a user back in using a cookie created with \fBmake\-cookie\fR. |
c0c23a60 | 82 | The response contains the username. |
eb5dc014 RK |
83 | .TP |
84 | .B deluser \fIUSERNAME | |
c0c23a60 RK |
85 | Delete the named user. |
86 | Requires the \fBadmin\fR right, and only works on local connections. | |
460b9539 | 87 | .TP |
88 | .B dirs \fIDIRECTORY\fR [\fIREGEXP\fR] | |
5818980a | 89 | List all the directories in \fIDIRECTORY\fR in a response body. |
460b9539 | 90 | If \fIREGEXP\fR is present only matching directories are returned. |
91 | .TP | |
92 | .B disable \fR[\fBnow\fR] | |
c0c23a60 RK |
93 | Disable further playing. |
94 | If the optional \fBnow\fR argument is present then the current track | |
95 | is stopped. | |
96 | Requires the \fBglobal prefs\fR right. | |
eb5dc014 RK |
97 | .TP |
98 | .B edituser \fIUSERNAME PROPERTY VALUE | |
c0c23a60 RK |
99 | Set a user property. |
100 | With the \fBadmin\fR right any username and property may be specified. | |
101 | Otherwise the \fBuserinfo\fR right is required and only the | |
eb5dc014 | 102 | \fBemail\fR and \fBpassword\fR properties may be set. |
0517868c RK |
103 | .IP |
104 | User properties are syntax-checked before setting. For instance \fBemail\fR | |
105 | must contain an "@" sign or you will get an error. (Setting an empty value for | |
106 | \fBemail\fR is allowed and removes the property.) | |
460b9539 | 107 | .TP |
108 | .B enable | |
c0c23a60 RK |
109 | Re-enable further playing, and is the opposite of \fBdisable\fR. |
110 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 111 | .TP |
112 | .B enabled | |
c0c23a60 RK |
113 | Report whether playing is enabled. |
114 | The second field of the response line will be \fByes\fR or \fBno\fR. | |
460b9539 | 115 | .TP |
116 | .B exists \fITRACK\fR | |
c0c23a60 RK |
117 | Report whether the named track exists. |
118 | The second field of the response line will be \fByes\fR or \fBno\fR. | |
460b9539 | 119 | .TP |
120 | .B files \fIDIRECTORY\fR [\fIREGEXP\fR] | |
5818980a | 121 | List all the files in \fIDIRECTORY\fR in a response body. |
460b9539 | 122 | If \fIREGEXP\fR is present only matching files are returned. |
123 | .TP | |
124 | .B get \fITRACK\fR \fIPREF\fR | |
c0c23a60 RK |
125 | Getsa preference value. |
126 | On success the second field of the response line will have the value. | |
fb1bc1f5 RK |
127 | .IP |
128 | If the track or preference do not exist then the response code is 555. | |
460b9539 | 129 | .TP |
0d350ff0 | 130 | .B get\-global \fIKEY\fR |
460b9539 | 131 | Get a global preference. |
fb1bc1f5 RK |
132 | .IP |
133 | If the preference does not exist then the response code is 555. | |
460b9539 | 134 | .TP |
135 | .B length \fITRACK\fR | |
c0c23a60 RK |
136 | Get the length of the track in seconds. |
137 | On success the second field of the response line will have the value. | |
460b9539 | 138 | .TP |
139 | .B log | |
c0c23a60 RK |
140 | Send event log messages in a response body. |
141 | The command will never terminate. | |
142 | Any further data sent to the server will be discarded (explicitly; | |
143 | i.e. it will not accumulate in a buffer somewhere). | |
460b9539 | 144 | .IP |
145 | See \fBEVENT LOG\fR below for more details. | |
146 | .TP | |
0d350ff0 | 147 | .B make\-cookie |
eb5dc014 RK |
148 | Returns an opaque string that can be used by the \fBcookie\fR command to log |
149 | this user back in on another connection (until the cookie expires). | |
150 | .TP | |
460b9539 | 151 | .B move \fITRACK\fR \fIDELTA\fR |
c0c23a60 RK |
152 | Move a track in the queue. |
153 | The track may be identified by ID (preferred) or name (which might cause | |
154 | confusion if it's there twice). | |
155 | \fIDELTA\fR should be an negative or positive integer and indicates how | |
156 | many steps towards the head of the queue the track should be moved. | |
eb5dc014 RK |
157 | .IP |
158 | Requires one of the \fBmove mine\fR, \fBmove random\fR or \fBmove any\fR rights | |
159 | depending on how the track came to be added to the queue. | |
460b9539 | 160 | .TP |
161 | .B moveafter \fITARGET\fR \fIID\fR ... | |
c0c23a60 RK |
162 | Move all the tracks in the \fIID\fR list after ID \fITARGET\fR. |
163 | If \fITARGET\fR is the empty string then the listed tracks are put | |
164 | at the head of the queue. | |
165 | If \fITARGET\fR is listed in the ID list then the tracks are moved | |
460b9539 | 166 | to just after the first non-listed track before it, or to the head if there is |
167 | no such track. | |
eb5dc014 RK |
168 | .IP |
169 | Requires one of the \fBmove mine\fR, \fBmove random\fR or \fBmove any\fR rights | |
170 | depending on how the tracks came to be added to the queue. | |
460b9539 | 171 | .TP |
2a10b70b | 172 | .B new \fR[\fIMAX\fR] |
c0c23a60 RK |
173 | Send the most recently added \fIMAX\fR tracks in a response body. |
174 | If the argument is ommitted, the \fBnew_max\fR most recent tracks are | |
175 | listed (see \fBdisorder_config\fR(5)). | |
2a10b70b | 176 | .TP |
7858930d | 177 | .B nop |
c0c23a60 RK |
178 | Do nothing. |
179 | Used by | |
7858930d | 180 | .BR disobedience (1) |
c0c23a60 RK |
181 | as a keepalive measure. |
182 | This command does not require authentication. | |
7858930d | 183 | .TP |
460b9539 | 184 | .B part \fITRACK\fR \fICONTEXT\fI \fIPART\fR |
c0c23a60 RK |
185 | Get a track name part. |
186 | Returns an empty string if a name part cannot be constructed. | |
460b9539 | 187 | .IP |
188 | .I CONTEXT | |
189 | is one of | |
190 | .B sort | |
191 | or | |
192 | .B display | |
193 | and | |
194 | .I PART | |
195 | is usually one of | |
196 | .BR artist , | |
197 | .B album | |
198 | or | |
199 | .BR title . | |
200 | .TP | |
201 | .B pause | |
c0c23a60 RK |
202 | Pause the current track. |
203 | Requires the \fBpause\fR right. | |
460b9539 | 204 | .TP |
205 | .B play \fITRACK\fR | |
c0c23a60 RK |
206 | Add a track to the queue. |
207 | The response contains the queue ID of the track. | |
eb5dc014 | 208 | Requires the \fBplay\fR right. |
460b9539 | 209 | .TP |
7a853280 RK |
210 | .B playafter \fITARGET\fR \fITRACK\fR ... |
211 | Add all the tracks in the \fITRACK\fR list to the queue after \fITARGET\fR | |
212 | (which should be a track ID). | |
213 | If \fITARGET\fR is the empty string then the listed tracks are put | |
214 | at the head of the queue. | |
215 | .IP | |
216 | Currently the success result does \fInot\fR include the new track IDs. | |
217 | .IP | |
218 | Requires the \fBplay\fR right. | |
219 | .TP | |
460b9539 | 220 | .B playing |
5818980a | 221 | Report what track is playing. |
460b9539 | 222 | .IP |
223 | If the response is \fB252\fR then the rest of the response line consists of | |
224 | track information (see below). | |
225 | .IP | |
226 | If the response is \fB259\fR then nothing is playing. | |
227 | .TP | |
fc80bbcd RK |
228 | .B playlist-delete \fIPLAYLIST\fR |
229 | Delete a playlist. | |
230 | Requires permission to modify that playlist and the \fBplay\fR right. | |
231 | .TP | |
232 | .B playlist-get \fIPLAYLIST\fR | |
233 | Get the contents of a playlist, in a response body. | |
234 | Requires permission to read that playlist and the \fBread\fR right. | |
235 | .TP | |
236 | .B playlist-get-share \fIPLAYLIST\fR | |
237 | Get the sharing status of a playlist. | |
238 | The result will be \fBpublic\fR, \fBprivate\fR or \fBshared\fR. | |
239 | Requires permission to read that playlist and the \fBread\fR right. | |
240 | .TP | |
241 | .B playlist-lock \fIPLAYLIST\fR | |
242 | Lock a playlist. | |
243 | Requires permission to modify that playlist and the \fBplay\fR right. | |
244 | Only one playlist may be locked at a time on a given connection and the lock | |
245 | automatically expires when the connection is closed. | |
246 | .TP | |
247 | .B playlist-set \fIPLAYLIST\fR | |
248 | Set the contents of a playlist. | |
249 | The new contents should be supplied in a command body. | |
250 | Requires permission to modify that playlist and the \fBplay\fR right. | |
251 | The playlist must be locked. | |
252 | .TP | |
253 | .B playlist-set-share \fIPLAYLIST\fR \fISHARE\fR | |
254 | Set the sharing status of a playlist to | |
255 | \fBpublic\fR, \fBprivate\fR or \fBshared\fR. | |
256 | Requires permission to modify that playlist and the \fBplay\fR right. | |
257 | .TP | |
258 | .B playlist-unlock\fR | |
259 | Unlock the locked playlist. | |
260 | .TP | |
261 | .B playlists | |
262 | List all playlists that this connection has permission to read. | |
263 | Requires the \fBread\fR right. | |
264 | .TP | |
460b9539 | 265 | .B prefs \fBTRACK\fR |
5818980a | 266 | Send back the preferences for \fITRACK\fR in a response body. |
460b9539 | 267 | Each line of the response has the usual line syntax, the first field being the |
268 | name of the pref and the second the value. | |
269 | .TP | |
270 | .B queue | |
5818980a | 271 | Send back the current queue in a response body, one track to a line, the track |
c0c23a60 RK |
272 | at the head of the queue (i.e. next to be be played) first. |
273 | See below for the track information syntax. | |
460b9539 | 274 | .TP |
0d350ff0 | 275 | .B random\-disable |
c0c23a60 RK |
276 | Disable random play (but don't stop the current track). |
277 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 278 | .TP |
0d350ff0 | 279 | .B random\-enable |
c0c23a60 RK |
280 | Enable random play. |
281 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 282 | .TP |
0d350ff0 | 283 | .B random\-enabled |
c0c23a60 RK |
284 | Report whether random play is enabled. |
285 | The second field of the response line will be \fByes\fR or \fBno\fR. | |
460b9539 | 286 | .TP |
287 | .B recent | |
5818980a | 288 | Send back the current recently-played list in a response body, one track to a |
c0c23a60 RK |
289 | line, the track most recently played last. |
290 | See below for the track information syntax. | |
460b9539 | 291 | .TP |
292 | .B reconfigure | |
c0c23a60 RK |
293 | Request that DisOrder reconfigure itself. |
294 | Requires the \fBadmin\fR right. | |
863c04fa RK |
295 | .IP |
296 | Not all configuration options can be modified during the lifetime of the | |
297 | server; of those that can't, some will just be ignored if they change while | |
298 | others will cause the new configuration to be rejected. | |
299 | See \fBdisorder_config\fR(5) for details. | |
460b9539 | 300 | .TP |
90ad6c6e | 301 | .B register \fIUSERNAME PASSWORD EMAIL |
c0c23a60 RK |
302 | Register a new user. |
303 | Requires the \fBregister\fR right. | |
304 | The result contains a confirmation string; the user will be be able | |
305 | to log in until this has been presented back to the server via the | |
306 | \fBconfirm\fR command. | |
ba39faf6 | 307 | .TP |
90ad6c6e RK |
308 | .B reminder \fIUSERNAME\fR |
309 | Send a password reminder to user \fIUSERNAME\fR. | |
c0c23a60 RK |
310 | If the user has no valid email address, or no password, or a |
311 | reminder has been sent too recently, then no reminder will be sent. | |
6207d2f3 | 312 | .TP |
460b9539 | 313 | .B remove \fIID\fR |
c0c23a60 RK |
314 | Remove the track identified by \fIID\fR. |
315 | Requires one of the \fBremove mine\fR, \fBremove random\fR or | |
316 | \fBremove any\fR rights depending on how the | |
eb5dc014 | 317 | track came to be added to the queue. |
460b9539 | 318 | .TP |
dd9af5cb | 319 | .B rescan \fR[\fBwait\fR] \fR[\fBfresh\fR] |
c0c23a60 RK |
320 | Rescan all roots for new or obsolete tracks. |
321 | Requires the \fBrescan\fR right. | |
dd9af5cb RK |
322 | .IP |
323 | If the \fBwait\fR flag is present then the response is delayed until the rescan | |
324 | completes. | |
325 | Otherwise the response arrives immediately. | |
326 | This is primarily intended for testing. | |
327 | .IP | |
328 | If the \fBfresh\fR flag is present a rescan is already underway then a second | |
329 | rescan will be started when it completes. | |
330 | The default behavior is to piggyback on the existing rescan. | |
331 | .IP | |
332 | NB that \fBfresh\fR is currently disabled in the server source, so using this | |
333 | flag will just provoke an error. | |
460b9539 | 334 | .TP |
335 | .B resolve \fITRACK\fR | |
336 | Resolve a track name, i.e. if this is an alias then return the real track name. | |
337 | .TP | |
338 | .B resume | |
c0c23a60 RK |
339 | Resume the current track after a \fBpause\fR command. |
340 | Requires the \fBpause\fR right. | |
eb5dc014 RK |
341 | .TP |
342 | .B revoke \fBcookie\fR | |
0d350ff0 | 343 | Revoke a cookie previously created with \fBmake\-cookie\fR. |
c0c23a60 | 344 | It will not be possible to use this cookie in the future. |
460b9539 | 345 | .TP |
0d350ff0 | 346 | .B rtp\-address |
5818980a | 347 | Report the RTP broadcast (or multicast) address, in the form \fIADDRESS |
c0c23a60 RK |
348 | PORT\fR. |
349 | This command does not require authentication. | |
ca831831 | 350 | .TP |
460b9539 | 351 | .B scratch \fR[\fIID\fR] |
352 | Remove the track identified by \fIID\fR, or the currently playing track if no | |
c0c23a60 RK |
353 | \fIID\fR is specified. |
354 | Requires one of the \fBscratch mine\fR, \fBscratch random\fR or | |
355 | \fBscratch any\fR rights depending on how the track came to be | |
eb5dc014 | 356 | added to the queue. |
460b9539 | 357 | .TP |
2b33c4cf RK |
358 | .B schedule-add \fIWHEN\fR \fIPRIORITY\fR \fIACTION\fR ... |
359 | Schedule an event for the future. | |
360 | .IP | |
361 | .I WHEN | |
362 | is the time when it should happen, as \fBtime_t\fR value. | |
363 | It must refer to a time in the future. | |
364 | .IP | |
365 | .I PRIORITY | |
366 | is the event priority. | |
367 | This can be \fBnormal\fR, in which case the event will be run at startup if its | |
368 | time has past, or \fBjunk\fR in which case it will be discarded if it is found | |
369 | to be in the past at startup. | |
370 | The meaning of other values is not defined. | |
371 | .IP | |
372 | .I ACTION | |
373 | is the action to perform. | |
374 | The choice of action determines the meaning of the remaining arguments. | |
375 | Possible actions are: | |
376 | .RS | |
377 | .TP | |
378 | .B play | |
379 | Play a track. | |
380 | The next argument is the track name. | |
381 | Requires the \fBplay\fR right. | |
382 | .TP | |
383 | .B set-global | |
384 | Set a global preference. | |
385 | The next argument is the preference name and the final argument is the value to | |
386 | set it to (omit it to unset it). | |
387 | Requires the \fBglobal prefs\fR right. | |
388 | .RE | |
389 | .IP | |
390 | You need the right at the point you create the event. | |
391 | It is not possible to create scheduled events in expectation of a future change | |
392 | in rights. | |
393 | .TP | |
394 | .B schedule-del \fIEVENT\fR | |
395 | Deletes a scheduled event. | |
396 | Users can always delete their own scheduled events; with the \fBadmin\fR | |
397 | right you can delete any event. | |
398 | .TP | |
399 | .B schedule-get \fIEVENT\fR | |
400 | Sends the details of scheduled event \fIEVENT\fR in a response body. | |
401 | Each line is a pair of strings quoted in the usual way, the first being the key | |
402 | ane the second the value. | |
403 | No particular order is used. | |
404 | .IP | |
405 | Scheduled events are considered public information. | |
406 | Right \fBread\fR is sufficient to see details of all events. | |
407 | .TP | |
408 | .B schedule-list | |
409 | Sends the event IDs of all scheduled events in a response body, in no | |
410 | particular order. | |
411 | Use \fBschedule-get\fR to get the details of each event. | |
412 | .TP | |
460b9539 | 413 | .B search \fITERMS\fR |
c0c23a60 RK |
414 | Search for tracks matching the search terms. |
415 | The results are put in a response body, one to a line. | |
460b9539 | 416 | .IP |
417 | The search string is split in the usual way, with quoting supported, into a | |
c0c23a60 RK |
418 | list of terms. |
419 | Only tracks matching all terms are included in the results. | |
460b9539 | 420 | .IP |
421 | Any terms of the form \fBtag:\fITAG\fR limits the search to tracks with that | |
422 | tag. | |
423 | .IP | |
424 | All other terms are interpreted as individual words which must be present in | |
425 | the track name. | |
426 | .IP | |
427 | Spaces in terms don't currently make sense, but may one day be interpreted to | |
428 | allow searching for phrases. | |
429 | .TP | |
430 | .B \fBset\fR \fITRACK\fR \fIPREF\fR \fIVALUE\fR | |
c0c23a60 RK |
431 | Set a preference. |
432 | Requires the \fBprefs\fR right. | |
460b9539 | 433 | .TP |
0d350ff0 | 434 | .B set\-global \fIKEY\fR \fIVALUE\fR |
c0c23a60 RK |
435 | Set a global preference. |
436 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 437 | .TP |
438 | .B stats | |
439 | Send server statistics in plain text in a response body. | |
440 | .TP | |
441 | .B \fBtags\fR | |
442 | Send the list of currently known tags in a response body. | |
443 | .TP | |
444 | .B \fBunset\fR \fITRACK\fR \fIPREF\fR | |
c0c23a60 RK |
445 | Unset a preference. |
446 | Requires the \fBprefs\fR right. | |
460b9539 | 447 | .TP |
0d350ff0 | 448 | .B \fBunset\-global\fR \fIKEY\fR |
c0c23a60 RK |
449 | Unset a global preference. |
450 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 451 | .TP |
90ad6c6e RK |
452 | .B user \fIUSERNAME\fR \fIRESPONSE\fR |
453 | Authenticate as user \fIUSERNAME\fR. | |
c0c23a60 | 454 | See |
5e3f9e08 RK |
455 | .B AUTHENTICATION |
456 | below. | |
460b9539 | 457 | .TP |
90ad6c6e | 458 | .B userinfo \fIUSERNAME PROPERTY |
3e3566ad RK |
459 | Get a user property. |
460 | .TP | |
eb5dc014 | 461 | .B users |
5818980a | 462 | Send the list of currently known users in a response body. |
eb5dc014 | 463 | .TP |
460b9539 | 464 | .B version |
465 | Send back a response with the server version as the second field. | |
466 | .TP | |
467 | .B volume \fR[\fILEFT\fR [\fIRIGHT\fR]] | |
468 | Get or set the volume. | |
469 | .IP | |
470 | With zero parameters just gets the volume and reports the left and right sides | |
471 | as the 2nd and 3rd fields of the response. | |
472 | .IP | |
c0c23a60 RK |
473 | With one parameter sets both sides to the same value. |
474 | With two parameters sets each side independently. | |
475 | Setting the volume requires the \fBvolume\fR right. | |
460b9539 | 476 | .SH RESPONSES |
c0c23a60 RK |
477 | Responses are three-digit codes. |
478 | The first digit distinguishes errors from succesful responses: | |
460b9539 | 479 | .TP |
480 | .B 2 | |
481 | Operation succeeded. | |
482 | .TP | |
483 | .B 5 | |
484 | Operation failed. | |
485 | .PP | |
486 | The second digit breaks down the origin of the response: | |
487 | .TP | |
488 | .B 0 | |
c0c23a60 RK |
489 | Generic responses not specific to the handling of the command. |
490 | Mostly this is parse errors. | |
460b9539 | 491 | .TP |
b4a80f69 | 492 | .B 1 |
493 | 51x errors indicate that the user had insufficient rights for the command. | |
494 | .TP | |
460b9539 | 495 | .B 3 |
496 | Authentication responses. | |
497 | .TP | |
498 | .B 5 | |
499 | Responses specific to the handling of the command. | |
500 | .PP | |
501 | The third digit provides extra information about the response: | |
502 | .TP | |
503 | .B 0 | |
504 | Text part is just commentary. | |
505 | .TP | |
506 | .B 1 | |
507 | Text part is a constant result e.g. \fBversion\fR. | |
508 | .TP | |
509 | .B 2 | |
510 | Text part is a potentially variable result. | |
511 | .TP | |
512 | .B 3 | |
513 | Text part is just commentary; a dot-stuffed body follows. | |
514 | .TP | |
515 | .B 4 | |
c0c23a60 RK |
516 | Text part is just commentary; an indefinite dot-stuffed body follows. |
517 | (Used for \fBlog\fR.) | |
460b9539 | 518 | .TP |
fb1bc1f5 | 519 | .B 5 |
c0c23a60 RK |
520 | Used with "normal" errors, for instance a preference not being found. |
521 | The text part is commentary. | |
fb1bc1f5 | 522 | .TP |
460b9539 | 523 | .B 9 |
524 | The text part is just commentary (but would normally be a response for this | |
525 | command) e.g. \fBplaying\fR. | |
7b32e917 RK |
526 | .PP |
527 | Result strings (not bodies) intended for machine parsing (i.e. xx1 and xx2 | |
528 | responses) are quoted. | |
460b9539 | 529 | .SH AUTHENTICATION |
5e3f9e08 | 530 | When a connection is made the server sends a \fB231\fR response before any |
c0c23a60 RK |
531 | command is received. |
532 | This contains a protocol generation, an algorithm name and a | |
533 | challenge encoded in hex, all separated by whitespace. | |
7b32e917 RK |
534 | .PP |
535 | The current protocol generation is \fB2\fR. | |
5e3f9e08 | 536 | .PP |
b3141726 | 537 | The possible algorithms are (currently) \fBsha1\fR, \fBsha256\fR, \fBsha384\fR |
c0c23a60 RK |
538 | and \fBsha512\fR. |
539 | \fBSHA1\fR etc work as synonyms. | |
460b9539 | 540 | .PP |
5e3f9e08 RK |
541 | The \fBuser\fR response consists of the selected hash of the user's password |
542 | concatenated with the challenge, encoded in hex. | |
460b9539 | 543 | .SH "TRACK INFORMATION" |
544 | Track information is encoded in a line (i.e. using the usual line syntax) as | |
c0c23a60 RK |
545 | pairs of fields. |
546 | The first is a name, the second a value. | |
547 | The names have the following meanings: | |
460b9539 | 548 | .TP 12 |
549 | .B expected | |
550 | The time the track is expected to be played at. | |
551 | .TP | |
552 | .B id | |
553 | A string uniquely identifying this queue entry. | |
554 | .TP | |
555 | .B played | |
556 | The time the track was played at. | |
557 | .TP | |
558 | .B scratched | |
559 | The user that scratched the track. | |
560 | .TP | |
d42e98ca RK |
561 | .B origin |
562 | The origin of the track. Valid origins are: | |
563 | .RS | |
564 | .TP 12 | |
565 | .B adopted | |
566 | The track was originally randomly picked but has been adopted by a user. | |
567 | .TP | |
568 | .B picked | |
569 | The track was picked by a user. | |
570 | .TP | |
571 | .B random | |
572 | The track was randomly picked. | |
573 | .TP | |
574 | .B scheduled | |
575 | The track was played from a scheduled action. | |
576 | .TP | |
577 | .B scratch | |
578 | The track is a scratch sound. | |
579 | .RE | |
580 | .TP | |
460b9539 | 581 | .B state |
c0c23a60 RK |
582 | The current track state. |
583 | Valid states are: | |
460b9539 | 584 | .RS |
585 | .TP 12 | |
586 | .B failed | |
587 | The player failed (exited with nonzero status but wasn't scratched). | |
588 | .TP | |
460b9539 | 589 | .B ok |
590 | The track was played without any problems. | |
591 | .TP | |
592 | .B scratched | |
593 | The track was scratched. | |
594 | .TP | |
595 | .B started | |
596 | The track is currently playing. | |
597 | .TP | |
d42e98ca RK |
598 | .B paused |
599 | Track is playing but paused. | |
600 | .TP | |
460b9539 | 601 | .B unplayed |
602 | In the queue, hasn't been played yet. | |
603 | .TP | |
604 | .B quitting | |
605 | The track was terminated because the server is shutting down. | |
606 | .RE | |
607 | .TP | |
608 | .B submitter | |
609 | The user that submitted the track. | |
610 | .TP | |
611 | .B track | |
612 | The filename of the track. | |
613 | .TP | |
614 | .B when | |
615 | The time the track was added to the queue. | |
616 | .TP | |
617 | .B wstat | |
618 | The wait status of the player in decimal. | |
d42e98ca RK |
619 | .PP |
620 | Note that \fBorigin\fR is new with DisOrder 4.3, and obsoletes some old | |
621 | \fBstate\fR values. | |
460b9539 | 622 | .SH NOTES |
623 | Times are decimal integers using the server's \fBtime_t\fR. | |
624 | .PP | |
625 | For file listings, the regexp applies to the basename of the returned file, not | |
c0c23a60 RK |
626 | the whole filename, and letter case is ignored. |
627 | \fBpcrepattern\fR(3) describes the regexp syntax. | |
460b9539 | 628 | .PP |
629 | Filenames are in UTF-8 even if the collection they come from uses some other | |
630 | encoding - if you want to access the real file (in such cases as the filenames | |
631 | actually correspond to a real file) you'll have to convert to whatever the | |
632 | right encoding is. | |
633 | .SH "EVENT LOG" | |
634 | The event log consists of lines starting with a hexadecimal timestamp and a | |
c0c23a60 RK |
635 | keyword followed by (optionally) parameters. |
636 | The parameters are quoted in the usual DisOrder way. | |
637 | Currently the following keywords are used: | |
460b9539 | 638 | .TP |
d42e98ca RK |
639 | .B adopted \fIID\fR \fIUSERNAME\fR |
640 | \fIUSERNAME\fR adopted track \fIID\fR. | |
641 | .TP | |
460b9539 | 642 | .B completed \fITRACK\fR |
643 | Completed playing \fITRACK\fR | |
644 | .TP | |
645 | .B failed \fITRACK\fR \fIERROR\fR | |
646 | Completed playing \fITRACK\fR with an error status | |
647 | .TP | |
90ad6c6e RK |
648 | .B moved \fIUSERNAME\fR |
649 | User \fIUSERNAME\fR moved some track(s). | |
c0c23a60 | 650 | Further details aren't included any more. |
460b9539 | 651 | .TP |
90ad6c6e | 652 | .B playing \fITRACK\fR [\fIUSERNAME\fR] |
460b9539 | 653 | Started playing \fITRACK\fR. |
654 | .TP | |
5c102112 RK |
655 | .B playlist_created \fIPLAYLIST\fR \fISHARING\fR |
656 | Sent when a playlist is created. | |
657 | For private playlists this is intended to be sent only to the owner (but | |
658 | this is not currently implemented). | |
659 | .TP | |
660 | .B playlist_deleted \fIPLAYLIST\fR | |
661 | Sent when a playlist is deleted. | |
662 | For private playlists this is intended to be sent only to the owner (but | |
663 | this is not currently implemented). | |
664 | .TP | |
665 | .B playlist_modified \fIPLAYLIST\fR \fISHARING\fR | |
666 | Sent when a playlist is modified (either its contents or its sharing status). | |
667 | For private playlists this is intended to be sent only to the owner (but | |
668 | this is not currently implemented). | |
669 | .TP | |
460b9539 | 670 | .B queue \fIQUEUE-ENTRY\fR... |
671 | Added \fITRACK\fR to the queue. | |
672 | .TP | |
673 | .B recent_added \fIQUEUE-ENTRY\fR... | |
674 | Added \fIID\fR to the recently played list. | |
675 | .TP | |
676 | .B recent_removed \fIID\fR | |
677 | Removed \fIID\fR from the recently played list. | |
678 | .TP | |
90ad6c6e | 679 | .B removed \fIID\fR [\fIUSERNAME\fR] |
c0c23a60 | 680 | Queue entry \fIID\fR was removed. |
90ad6c6e | 681 | This is used both for explicit removal (when \fIUSERNAME\fR is present) |
c0c23a60 | 682 | and when playing a track (when it is absent). |
460b9539 | 683 | .TP |
e025abff RK |
684 | .B rescanned |
685 | A rescan completed. | |
686 | .TP | |
90ad6c6e RK |
687 | .B scratched \fITRACK\fR \fIUSERNAME\fR |
688 | \fITRACK\fR was scratched by \fIUSERNAME\fR. | |
460b9539 | 689 | .TP |
690 | .B state \fIKEYWORD\fR | |
c0c23a60 RK |
691 | Some state change occurred. |
692 | The current set of keywords is: | |
460b9539 | 693 | .RS |
694 | .TP | |
5abe307a RK |
695 | .B completed |
696 | The current track completed successfully. | |
697 | .TP | |
460b9539 | 698 | .B disable_play |
699 | Playing was disabled. | |
700 | .TP | |
701 | .B disable_random | |
702 | Random play was disabled. | |
703 | .TP | |
704 | .B enable_play | |
705 | Playing was enabled. | |
706 | .TP | |
707 | .B enable_random | |
708 | Random play was enabled. | |
709 | .TP | |
5abe307a RK |
710 | .B failed |
711 | The current track failed. | |
712 | .TP | |
460b9539 | 713 | .B pause |
714 | The current track was paused. | |
715 | .TP | |
5abe307a RK |
716 | .B playing |
717 | A track started playing. | |
718 | .TP | |
460b9539 | 719 | .B resume |
720 | The current track was resumed. | |
5abe307a | 721 | .TP |
75e7b7c3 | 722 | .B rights_changed \fIRIGHTS\fR |
ad492e00 RK |
723 | User's rights were changed. |
724 | .TP | |
5abe307a RK |
725 | .B scratched |
726 | The current track was scratched. | |
727 | .PP | |
728 | To simplify client implementation, \fBstate\fR commands reflecting the current | |
729 | state are sent at the start of the log. | |
460b9539 | 730 | .RE |
bb03d79d | 731 | .TP |
75e7b7c3 | 732 | .B user_add \fIUSERNAME\fR |
58d2aad2 RK |
733 | A user was created. |
734 | .TP | |
75e7b7c3 | 735 | .B user_delete \fIUSERNAME\fR |
58d2aad2 RK |
736 | A user was deleted. |
737 | .TP | |
75e7b7c3 | 738 | .B user_edit \fIUSERNAME\fR \fIPROPERTY\fR |
58d2aad2 RK |
739 | Some property of a user was edited. |
740 | .TP | |
75e7b7c3 | 741 | .B user_confirm \fIUSERNAME\fR |
58d2aad2 | 742 | A user's login was confirmed (via the web interface). |
460b9539 | 743 | .TP |
744 | .B volume \fILEFT\fR \fIRIGHT\fR | |
745 | The volume changed. | |
746 | .PP | |
747 | .IR QUEUE-ENTRY ... | |
748 | is as defined in | |
749 | .B "TRACK INFORMATION" | |
750 | above. | |
58d2aad2 RK |
751 | .PP |
752 | The \fBuser-*\fR messages are only sent to admin users, and are not sent over | |
753 | non-local connections unless \fBremote_userman\fR is enabled. | |
f9635e06 | 754 | .SH "CHARACTER ENCODING" |
c0c23a60 RK |
755 | All data sent by both server and client is encoded using UTF-8. |
756 | Moreover it must be valid UTF-8, i.e. non-minimal sequences are not | |
757 | permitted, nor are surrogates, nor are code points outside the | |
758 | Unicode code space. | |
f9635e06 RK |
759 | .PP |
760 | There are no particular normalization requirements on either side of the | |
c0c23a60 RK |
761 | protocol. |
762 | The server currently converts internally to NFC, the client must | |
f9635e06 RK |
763 | normalize the responses returned if it needs some normalized form for further |
764 | processing. | |
765 | .PP | |
766 | The various characters which divide up lines may not be followed by combining | |
c0c23a60 RK |
767 | characters. |
768 | For instance all of the following are prohibited: | |
f9635e06 RK |
769 | .TP |
770 | .B o | |
c0c23a60 RK |
771 | LINE FEED followed by a combining character. |
772 | For example the sequence LINE FEED, COMBINING GRAVE ACCENT is never permitted. | |
f9635e06 RK |
773 | .TP |
774 | .B o | |
775 | APOSTROPHE or QUOTATION MARK followed by a combining character when used to | |
c0c23a60 RK |
776 | delimit fields. |
777 | For instance a line starting APOSTROPHE, COMBINING CEDILLA is prohibited. | |
f9635e06 RK |
778 | .IP |
779 | Note that such sequences are not prohibited when the quote character cannot be | |
c0c23a60 RK |
780 | interpreted as a field delimiter. |
781 | For instance APOSTROPHE, REVERSE SOLIDUS, APOSTROPHE, COMBINING CEDILLA, | |
782 | APOSTROPHE would be permitted. | |
f9635e06 RK |
783 | .TP |
784 | .B o | |
785 | REVERSE SOLIDUS (BACKSLASH) followed by a combining character in a quoted | |
c0c23a60 RK |
786 | string when it is the first character of an escape sequence. |
787 | For instance a line starting APOSTROPHE, REVERSE SOLIDUS, COMBINING TILDE | |
788 | is prohibited. | |
f9635e06 RK |
789 | .IP |
790 | As above such sequences are not prohibited when the character is not being used | |
c0c23a60 RK |
791 | to start an escape sequence. |
792 | For instance APOSTROPHE, REVERSE SOLIDUS, REVERSE SOLIDS, COMBINING TILDE, | |
793 | APOSTROPHE is permitted. | |
f9635e06 RK |
794 | .TP |
795 | .B o | |
796 | Any of the field-splitting whitespace characters followed by a combining | |
c0c23a60 RK |
797 | character when not part of a quoted field. |
798 | For instance a line starting COLON, SPACE, COMBINING CANDRABINDU is prohibited. | |
f9635e06 RK |
799 | .IP |
800 | As above non-delimiter uses are fine. | |
801 | .TP | |
802 | .B o | |
803 | The FULL STOP characters used to quote or delimit a body. | |
804 | .PP | |
805 | Furthermore none of these characters are permitted to appear in the context of | |
806 | a canonical decomposition (i.e. they must still be present when converted to | |
c0c23a60 RK |
807 | NFC). |
808 | In practice however this is not an issue in Unicode 5.0. | |
f9635e06 RK |
809 | .PP |
810 | These rules are consistent with the observation that the split() function is | |
c0c23a60 RK |
811 | essentially a naive ASCII parser. |
812 | The implication is not that these sequences never actually appear in | |
813 | the protocol, merely that the server is not required to honor them in | |
814 | any useful way nor be consistent between versions: in current | |
f9635e06 RK |
815 | versions the result will be lines and fields that start with combining |
816 | characters and are not necessarily split where you expect, but future versions | |
817 | may remove them, reject them or ignore some or all of the delimiters that have | |
818 | following combining characters, and no notice will be given of any change. | |
460b9539 | 819 | .SH "SEE ALSO" |
820 | \fBdisorder\fR(1), | |
821 | \fBtime\fR(2), | |
822 | \fBdisorder\fR(3), | |
823 | \fBpcrepattern\fR(3) | |
824 | \fBdisorder_config\fR(5), | |
825 | \fBdisorderd\fR(8), | |
826 | \fButf8\fR(7) | |
827 | .\" Local Variables: | |
828 | .\" mode:nroff | |
829 | .\" fill-column:79 | |
830 | .\" End: |