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