2 .\" Copyright (C) 2004, 2005, 2006 Richard Kettlewell
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.
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.
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
19 .TH disorder_protocol 5
21 disorder_protocol \- DisOrder communication protocol
23 The DisOrder client and server communicate via the protocol described
26 The protocol is liable to change without notice. You are recommended to check
27 the implementation before believing this document.
29 Everything is encoded using UTF-8. See
30 .B "CHARACTER ENCODING"
31 below for more detail on character encoding issues.
33 Commands and responses consist of a line perhaps followed (depending on the
34 command or response) by a body.
36 The line syntax is the same as described in \fBdisorder_config\fR(5) except
37 that comments are prohibited.
39 Bodies borrow their syntax from RFC821; they consist of zero or more ordinary
40 lines, with any initial full stop doubled up, and are terminated by a line
41 consisting of a full stop and a line feed.
43 Commands always have a command name as the first field of the line; responses
44 always have a 3-digit response code as the first field. See below for more
45 details about this field.
47 All commands require the connection to have been already authenticated unless
50 Neither commands nor responses have a body unless stated otherwise.
52 .B allfiles \fIDIRECTORY\fR [\fIREGEXP\fR]
53 Lists all the files and directories in \fIDIRECTORY\fR in a response body.
54 If \fIREGEXP\fR is present only matching files and directories are returned.
57 Instructs the server to treat the connection as if \fIUSER\fR had
58 authenticated it. Only trusted users may issue this command.
60 .B dirs \fIDIRECTORY\fR [\fIREGEXP\fR]
61 Lists all the directories in \fIDIRECTORY\fR in a response body.
62 If \fIREGEXP\fR is present only matching directories are returned.
64 .B disable \fR[\fBnow\fR]
65 Disables further playing. If the optional \fBnow\fR argument is present then
66 the current track is stopped.
69 Re-enables further playing, and is the opposite of \fBdisable\fR.
72 Reports whether playing is enabled. The second field of the response line will
73 be \fByes\fR or \fBno\fR.
76 Reports whether the named track exists. The second field of the response line
77 will be \fByes\fR or \fBno\fR.
79 .B files \fIDIRECTORY\fR [\fIREGEXP\fR]
80 Lists all the files in \fIDIRECTORY\fR in a response body.
81 If \fIREGEXP\fR is present only matching files are returned.
83 .B get \fITRACK\fR \fIPREF\fR
84 Gets a preference value. On success the second field of the response line will
87 .B get-global \fIKEY\fR
88 Get a global preference.
91 Gets the length of the track in seconds. On success the second field of the
92 response line will have the value.
95 Sends event log messages in a response body. The command will never terminate.
96 Any further data sent to the server will be discarded (explicitly; i.e. it will
97 not accumulate in a buffer somewhere).
99 See \fBEVENT LOG\fR below for more details.
101 .B move \fITRACK\fR \fIDELTA\fR
102 Move a track in the queue. The track may be identified by ID (preferred) or
103 name (which might cause confusion if it's there twice). \fIDELTA\fR should be
104 an negative or positive integer and indicates how many steps towards the head
105 of the queue the track should be moved.
107 .B moveafter \fITARGET\fR \fIID\fR ...
108 Move all the tracks in the \fIID\fR list after ID \fITARGET\fR. If
109 \fITARGET\fR is the empty string then the listed tracks are put at the head of
110 the queue. If \fITARGET\fR is listed in the ID list then the tracks are moved
111 to just after the first non-listed track before it, or to the head if there is
114 .B new \fR[\fIMAX\fR]
115 Sends the most recently added \fIMAX\fR tracks in a response body. If the
116 argument is ommitted, all recently added tracks are listed.
121 as a keepalive measure.
123 .B part \fITRACK\fR \fICONTEXT\fI \fIPART\fR
124 Get a track name part. Returns an empty string if a name part cannot be
141 Pause the current track.
144 Add a track to the queue.
147 Reports what track is playing.
149 If the response is \fB252\fR then the rest of the response line consists of
150 track information (see below).
152 If the response is \fB259\fR then nothing is playing.
155 Sends back the preferences for \fITRACK\fR in a response body.
156 Each line of the response has the usual line syntax, the first field being the
157 name of the pref and the second the value.
160 Sends back the current queue in a response body, one track to a line, the track
161 at the head of the queue (i.e. next to be be played) first. See below for the
162 track information syntax.
165 Disable random play (but don't stop the current track).
171 Reports whether random play is enabled. The second field of the response line
172 will be \fByes\fR or \fBno\fR.
175 Sends back the current recently-played list in a response body, one track to a
176 line, the track most recently played last. See below for the track
180 Request that DisOrder reconfigure itself. Only trusted users may issue this
184 Remove the track identified by \fIID\fR. If \fBrestrict remove\fR is enabled
185 in the server's configuration then only the user that submitted the track may
189 Rescan all roots for new or obsolete tracks.
191 .B resolve \fITRACK\fR
192 Resolve a track name, i.e. if this is an alias then return the real track name.
195 Resume the current track after a \fBpause\fR command.
198 Reports the RTP broadcast (or multicast) address, in the form \fIADDRESS
201 .B scratch \fR[\fIID\fR]
202 Remove the track identified by \fIID\fR, or the currently playing track if no
203 \fIID\fR is specified. If \fBrestrict scratch\fR is enabled in the server's
204 configuration then only the user that submitted the track may scratch it.
206 .B search \fITERMS\fR
207 Search for tracks matching the search terms. The results are put in a response
210 The search string is split in the usual way, with quoting supported, into a
211 list of terms. Only tracks matching all terms are included in the results.
213 Any terms of the form \fBtag:\fITAG\fR limits the search to tracks with that
216 All other terms are interpreted as individual words which must be present in
219 Spaces in terms don't currently make sense, but may one day be interpreted to
220 allow searching for phrases.
222 .B \fBset\fR \fITRACK\fR \fIPREF\fR \fIVALUE\fR
225 .B set-global \fIKEY\fR \fIVALUE\fR
226 Set a global preference.
229 Send server statistics in plain text in a response body.
232 Send the list of currently known tags in a response body.
234 .B \fBunset\fR \fITRACK\fR \fIPREF\fR
237 .B \fBunset-global\fR \fIKEY\fR
238 Unset a global preference.
240 .B user \fIUSER\fR \fIRESPONSE\fR
241 Authenticate as \fIUSER\fR. See
246 Send back a response with the server version as the second field.
248 .B volume \fR[\fILEFT\fR [\fIRIGHT\fR]]
249 Get or set the volume.
251 With zero parameters just gets the volume and reports the left and right sides
252 as the 2nd and 3rd fields of the response.
254 With one parameter sets both sides to the same value. With two parameters sets
255 each side independently.
257 Responses are three-digit codes. The first digit distinguishes errors from
266 The second digit breaks down the origin of the response:
269 Generic responses not specific to the handling of the command. Mostly this is
273 Authentication responses.
276 Responses specific to the handling of the command.
278 The third digit provides extra information about the response:
281 Text part is just commentary.
284 Text part is a constant result e.g. \fBversion\fR.
287 Text part is a potentially variable result.
290 Text part is just commentary; a dot-stuffed body follows.
293 Text part is just commentary; an indefinite dot-stuffed body follows. (Used
297 The text part is just commentary (but would normally be a response for this
298 command) e.g. \fBplaying\fR.
300 When a connection is made the server sends a \fB231\fR response before any
301 command is received. This contains an algorithm name and a challenge encoded
304 Currently the algorithm name is omitted if it is \fBsha1\fR (but this will
305 probably change in a future version). The other options are \fBsha256\fR,
306 \fBsha384\fR and \fBsha512\fR. \fBSHA1\fR etc work as synonyms.
308 The \fBuser\fR response consists of the selected hash of the user's password
309 concatenated with the challenge, encoded in hex.
310 .SH "TRACK INFORMATION"
311 Track information is encoded in a line (i.e. using the usual line syntax) as
312 pairs of fields. The first is a name, the second a value. The names have the
316 The time the track is expected to be played at.
319 A string uniquely identifying this queue entry.
322 The time the track was played at.
325 The user that scratched the track.
328 The current track state. Valid states are:
332 The player failed (exited with nonzero status but wasn't scratched).
335 The track is actually a scratch.
338 No player could be found for the track.
341 The track was played without any problems.
344 The track was scratched.
347 The track is currently playing.
350 In the queue, hasn't been played yet.
353 The track was terminated because the server is shutting down.
357 The user that submitted the track.
360 The filename of the track.
363 The time the track was added to the queue.
366 The wait status of the player in decimal.
368 Times are decimal integers using the server's \fBtime_t\fR.
370 For file listings, the regexp applies to the basename of the returned file, not
371 the whole filename, and letter case is ignored. \fBpcrepattern\fR(3) describes
374 Filenames are in UTF-8 even if the collection they come from uses some other
375 encoding - if you want to access the real file (in such cases as the filenames
376 actually correspond to a real file) you'll have to convert to whatever the
379 The event log consists of lines starting with a hexadecimal timestamp and a
380 keyword followed by (optionally) parameters. The parameters are quoted in the
381 usual DisOrder way. Currently the following keywords are used:
383 .B completed \fITRACK\fR
384 Completed playing \fITRACK\fR
386 .B failed \fITRACK\fR \fIERROR\fR
387 Completed playing \fITRACK\fR with an error status
390 User \fIUSER\fR moved some track(s). Further details aren't included any
393 .B playing \fITRACK\fR [\fIUSER\fR]
394 Started playing \fITRACK\fR.
396 .B queue \fIQUEUE-ENTRY\fR...
397 Added \fITRACK\fR to the queue.
399 .B recent_added \fIQUEUE-ENTRY\fR...
400 Added \fIID\fR to the recently played list.
402 .B recent_removed \fIID\fR
403 Removed \fIID\fR from the recently played list.
405 .B removed \fIID\fR [\fIUSER\fR]
406 Queue entry \fIID\fR was removed. This is used both for explicit removal (when
407 \fIUSER\fR is present) and when playing a track (when it is absent).
412 .B scratched \fITRACK\fR \fIUSER\fR
413 \fITRACK\fR was scratched by \fIUSER\fR.
415 .B state \fIKEYWORD\fR
416 Some state change occurred. The current set of keywords is:
420 The current track completed successfully.
423 Playing was disabled.
426 Random play was disabled.
432 Random play was enabled.
435 The current track failed.
438 The current track was paused.
441 A track started playing.
444 The current track was resumed.
447 The current track was scratched.
449 To simplify client implementation, \fBstate\fR commands reflecting the current
450 state are sent at the start of the log.
453 .B volume \fILEFT\fR \fIRIGHT\fR
458 .B "TRACK INFORMATION"
460 .SH "CHARACTER ENCODING"
461 All data sent by both server and client is encoded using UTF-8. Moreover it
462 must be valid UTF-8, i.e. non-minimal sequences are not permitted, nor are
463 surrogates, nor are code points outside the Unicode code space.
465 There are no particular normalization requirements on either side of the
466 protocol. The server currently converts internally to NFC, the client must
467 normalize the responses returned if it needs some normalized form for further
470 The various characters which divide up lines may not be followed by combining
471 characters. For instance all of the following are prohibited:
474 LINE FEED followed by a combining character. For example the sequence
475 LINE FEED, COMBINING GRAVE ACCENT is never permitted.
478 APOSTROPHE or QUOTATION MARK followed by a combining character when used to
479 delimit fields. For instance a line starting APOSTROPHE, COMBINING CEDILLA
482 Note that such sequences are not prohibited when the quote character cannot be
483 interpreted as a field delimiter. For instance APOSTROPHE, REVERSE SOLIDUS,
484 APOSTROPHE, COMBINING CEDILLA, APOSTROPHE would be permitted.
487 REVERSE SOLIDUS (BACKSLASH) followed by a combining character in a quoted
488 string when it is the first character of an escape sequence. For instance a
489 line starting APOSTROPHE, REVERSE SOLIDUS, COMBINING TILDE is prohibited.
491 As above such sequences are not prohibited when the character is not being used
492 to start an escape sequence. For instance APOSTROPHE, REVERSE SOLIDUS,
493 REVERSE SOLIDS, COMBINING TILDER, APOSTROPHE is permitted.
496 Any of the field-splitting whitespace characters followed by a combining
497 character when not part of a quoted field. For instance a line starting COLON,
498 SPACE, COMBINING CANDRABINDU is prohibited.
500 As above non-delimiter uses are fine.
503 The FULL STOP characters used to quote or delimit a body.
505 Furthermore none of these characters are permitted to appear in the context of
506 a canonical decomposition (i.e. they must still be present when converted to
507 NFC). In practice however this is not an issue in Unicode 5.0.
509 These rules are consistent with the observation that the split() function is
510 essentially a naive ASCII parser. The implication is not that these sequences
511 never actually appear in the protocol, merely that the server is not required
512 to honor them in any useful way nor be consistent between versions: in current
513 versions the result will be lines and fields that start with combining
514 characters and are not necessarily split where you expect, but future versions
515 may remove them, reject them or ignore some or all of the delimiters that have
516 following combining characters, and no notice will be given of any change.
522 \fBdisorder_config\fR(5),