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.
31 Commands and responses consist of a line followed (depending on the
32 command or response) by a message.
34 The line syntax is the same as described in \fBdisorder_config\fR(5) except
35 that comments are prohibited.
37 Bodies borrow their syntax from RFC821; they consist of zero or more ordinary
38 lines, with any initial full stop doubled up, and are terminated by a line
39 consisting of a full stop and a line feed.
41 Commands always have a command name as the first field of the line; responses
42 always have a 3-digit response code as the first field. See below for more
43 details about this field.
45 All commands require the connection to have been already authenticated unless
48 Neither commands nor responses have a body unless stated otherwise.
50 .B allfiles \fIDIRECTORY\fR [\fIREGEXP\fR]
51 Lists all the files and directories in \fIDIRECTORY\fR in a response body.
52 If \fIREGEXP\fR is present only matching files and directories are returned.
55 Instructs the server to treat the connection as if \fIUSER\fR had
56 authenticated it. Only trusted users may issue this command.
58 .B dirs \fIDIRECTORY\fR [\fIREGEXP\fR]
59 Lists all the directories in \fIDIRECTORY\fR in a response body.
60 If \fIREGEXP\fR is present only matching directories are returned.
62 .B disable \fR[\fBnow\fR]
63 Disables further playing. If the optional \fBnow\fR argument is present then
64 the current track is stopped.
67 Re-enables further playing, and is the opposite of \fBdisable\fR.
70 Reports whether playing is enabled. The second field of the response line will
71 be \fByes\fR or \fBno\fR.
74 Reports whether the named track exists. The second field of the response line
75 will be \fByes\fR or \fBno\fR.
77 .B files \fIDIRECTORY\fR [\fIREGEXP\fR]
78 Lists all the files in \fIDIRECTORY\fR in a response body.
79 If \fIREGEXP\fR is present only matching files are returned.
81 .B get \fITRACK\fR \fIPREF\fR
82 Gets a preference value. On success the second field of the response line will
85 .B get-global \fIKEY\fR
86 Get a global preference.
89 Gets the length of the track in seconds. On success the second field of the
90 response line will have the value.
93 Sends event log messages in a response body. The command will only terminate (and
94 close the response body with a final dot) when a further command is readable on
95 the control connection.
97 See \fBEVENT LOG\fR below for more details.
99 .B move \fITRACK\fR \fIDELTA\fR
100 Move a track in the queue. The track may be identified by ID (preferred) or
101 name (which might cause confusion if it's there twice). \fIDELTA\fR should be
102 an negative or positive integer and indicates how many steps towards the head
103 of the queue the track should be moved.
105 .B moveafter \fITARGET\fR \fIID\fR ...
106 Move all the tracks in the \fIID\fR list after ID \fITARGET\fR. If
107 \fITARGET\fR is the empty string then the listed tracks are put at the head of
108 the queue. If \fITARGET\fR is listed in the ID list then the tracks are moved
109 to just after the first non-listed track before it, or to the head if there is
112 .B new \fR[\fIMAX\fR]
113 Sends the most recently added \fIMAX\fR tracks in a response body. If the
114 argument is ommitted, all recently added tracks are listed.
119 as a keepalive measure.
121 .B part \fITRACK\fR \fICONTEXT\fI \fIPART\fR
122 Get a track name part. Returns an empty string if a name part cannot be
139 Pause the current track.
142 Add a track to the queue.
145 Reports what track is playing.
147 If the response is \fB252\fR then the rest of the response line consists of
148 track information (see below).
150 If the response is \fB259\fR then nothing is playing.
153 Sends back the preferences for \fITRACK\fR in a response body.
154 Each line of the response has the usual line syntax, the first field being the
155 name of the pref and the second the value.
158 Sends back the current queue in a response body, one track to a line, the track
159 at the head of the queue (i.e. next to be be played) first. See below for the
160 track information syntax.
163 Disable random play (but don't stop the current track).
169 Reports whether random play is enabled. The second field of the response line
170 will be \fByes\fR or \fBno\fR.
173 Sends back the current recently-played list in a response body, one track to a
174 line, the track most recently played last. See below for the track
178 Request that DisOrder reconfigure itself. Only trusted users may issue this
182 Remove the track identified by \fIID\fR. If \fBrestrict remove\fR is enabled
183 in the server's configuration then only the user that submitted the track may
187 Rescan all roots for new or obsolete tracks.
189 .B resolve \fITRACK\fR
190 Resolve a track name, i.e. if this is an alias then return the real track name.
193 Resume the current track after a \fBpause\fR command.
195 .B scratch \fR[\fIID\fR]
196 Remove the track identified by \fIID\fR, or the currently playing track if no
197 \fIID\fR is specified. If \fBrestrict scratch\fR is enabled in the server's
198 configuration then only the user that submitted the track may scratch it.
200 .B search \fITERMS\fR
201 Search for tracks matching the search terms. The results are put in a response
204 The search string is split in the usual way, with quoting supported, into a
205 list of terms. Only tracks matching all terms are included in the results.
207 Any terms of the form \fBtag:\fITAG\fR limits the search to tracks with that
210 All other terms are interpreted as individual words which must be present in
213 Spaces in terms don't currently make sense, but may one day be interpreted to
214 allow searching for phrases.
216 .B \fBset\fR \fITRACK\fR \fIPREF\fR \fIVALUE\fR
219 .B set-global \fIKEY\fR \fIVALUE\fR
220 Set a global preference.
223 Send server statistics in plain text in a response body.
226 Send the list of currently known tags in a response body.
228 .B \fBunset\fR \fITRACK\fR \fIPREF\fR
231 .B \fBunset-global\fR \fIKEY\fR
232 Unset a global preference.
234 .B user \fIUSER\fR \fIRESPONSE\fR
235 Authenticate as \fIUSER\fR. See
240 Send back a response with the server version as the second field.
242 .B volume \fR[\fILEFT\fR [\fIRIGHT\fR]]
243 Get or set the volume.
245 With zero parameters just gets the volume and reports the left and right sides
246 as the 2nd and 3rd fields of the response.
248 With one parameter sets both sides to the same value. With two parameters sets
249 each side independently.
251 Responses are three-digit codes. The first digit distinguishes errors from
260 The second digit breaks down the origin of the response:
263 Generic responses not specific to the handling of the command. Mostly this is
267 Authentication responses.
270 Responses specific to the handling of the command.
272 The third digit provides extra information about the response:
275 Text part is just commentary.
278 Text part is a constant result e.g. \fBversion\fR.
281 Text part is a potentially variable result.
284 Text part is just commentary; a dot-stuffed body follows.
287 Text part is just commentary; an indefinite dot-stuffed body follows. (Used
291 Text part is just commentary; an indefinite dot-stuffed body follows. (Used
295 The text part is just commentary (but would normally be a response for this
296 command) e.g. \fBplaying\fR.
298 When a connection is made the server sends a \fB231\fR response before any
299 command is received. This contains an algorithm name and a challenge encoded
302 Currently the algorithm name is omitted if it is \fBsha1\fR (but this will
303 probably change in a future version). The other options are \fBsha256\fR,
304 \fBsha384\fR and \fBsha512\fR. \fBSHA1\fR etc work as synonyms.
306 The \fBuser\fR response consists of the selected hash of the user's password
307 concatenated with the challenge, encoded in hex.
308 .SH "TRACK INFORMATION"
309 Track information is encoded in a line (i.e. using the usual line syntax) as
310 pairs of fields. The first is a name, the second a value. The names have the
314 The time the track is expected to be played at.
317 A string uniquely identifying this queue entry.
320 The time the track was played at.
323 The user that scratched the track.
326 The current track state. Valid states are:
330 The player failed (exited with nonzero status but wasn't scratched).
333 The track is actually a scratch.
336 No player could be found for the track.
339 The track was played without any problems.
342 The track was scratched.
345 The track is currently playing.
348 In the queue, hasn't been played yet.
351 The track was terminated because the server is shutting down.
355 The user that submitted the track.
358 The filename of the track.
361 The time the track was added to the queue.
364 The wait status of the player in decimal.
366 Times are decimal integers using the server's \fBtime_t\fR.
368 For file listings, the regexp applies to the basename of the returned file, not
369 the whole filename, and letter case is ignored. \fBpcrepattern\fR(3) describes
372 Filenames are in UTF-8 even if the collection they come from uses some other
373 encoding - if you want to access the real file (in such cases as the filenames
374 actually correspond to a real file) you'll have to convert to whatever the
377 The event log consists of lines starting with a hexadecimal timestamp and a
378 keyword followed by (optionally) parameters. The parameters are quoted in the
379 usual DisOrder way. Currently the following keywords are used:
381 .B completed \fITRACK\fR
382 Completed playing \fITRACK\fR
384 .B failed \fITRACK\fR \fIERROR\fR
385 Completed playing \fITRACK\fR with an error status
388 User \fIUSER\fR moved some track(s). Further details aren't included any
391 .B playing \fITRACK\fR [\fIUSER\fR]
392 Started playing \fITRACK\fR.
394 .B queue \fIQUEUE-ENTRY\fR...
395 Added \fITRACK\fR to the queue.
397 .B recent_added \fIQUEUE-ENTRY\fR...
398 Added \fIID\fR to the recently played list.
400 .B recent_removed \fIID\fR
401 Removed \fIID\fR from the recently played list.
403 .B removed \fIID\fR [\fIUSER\fR]
404 Queue entry \fIID\fR was removed. This is used both for explicit removal (when
405 \fIUSER\fR is present) and when playing a track (when it is absent).
410 .B scratched \fITRACK\fR \fIUSER\fR
411 \fITRACK\fR was scratched by \fIUSER\fR.
413 .B state \fIKEYWORD\fR
414 Some state change occurred. The current set of keywords is:
418 The current track completed successfully.
421 Playing was disabled.
424 Random play was disabled.
430 Random play was enabled.
433 The current track failed.
436 The current track was paused.
439 A track started playing.
442 The current track was resumed.
445 The current track was scratched.
447 To simplify client implementation, \fBstate\fR commands reflecting the current
448 state are sent at the start of the log.
451 .B volume \fILEFT\fR \fIRIGHT\fR
456 .B "TRACK INFORMATION"
463 \fBdisorder_config\fR(5),