chiark / gitweb /
typo in man disorder-playrtp
[disorder] / doc / disorder_protocol.5.in
CommitLineData
460b9539 1.\"
2.\" Copyright (C) 2004, 2005, 2006 Richard Kettlewell
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
21disorder_protocol \- DisOrder communication protocol
22.SH DESCRIPTION
23The DisOrder client and server communicate via the protocol described
24in this man page.
25.PP
26The protocol is liable to change without notice. You are recommended to check
27the implementation before believing this document.
28.SH "GENERAL SYNTAX"
29Everything is encoded using UTF-8.
30.PP
31Commands and responses consist of a line followed (depending on the
32command or response) by a message.
33.PP
34The line syntax is the same as described in \fBdisorder_config\fR(5) except
35that comments are prohibited.
36.PP
37Bodies borrow their syntax from RFC821; they consist of zero or more ordinary
38lines, with any initial full stop doubled up, and are terminated by a line
39consisting of a full stop and a line feed.
40.SH COMMANDS
41Commands always have a command name as the first field of the line; responses
42always have a 3-digit response code as the first field. See below for more
43details about this field.
44.PP
45All commands require the connection to have been already authenticated unless
46stated otherwise.
47.PP
48Neither commands nor responses have a body unless stated otherwise.
49.TP
50.B allfiles \fIDIRECTORY\fR [\fIREGEXP\fR]
51Lists all the files and directories in \fIDIRECTORY\fR in a response body.
52If \fIREGEXP\fR is present only matching files and directories are returned.
53.TP
54.B become \fIUSER\fR
55Instructs the server to treat the connection as if \fIUSER\fR had
56authenticated it. Only trusted users may issue this command.
57.TP
58.B dirs \fIDIRECTORY\fR [\fIREGEXP\fR]
59Lists all the directories in \fIDIRECTORY\fR in a response body.
60If \fIREGEXP\fR is present only matching directories are returned.
61.TP
62.B disable \fR[\fBnow\fR]
63Disables further playing. If the optional \fBnow\fR argument is present then
64the current track is stopped.
65.TP
66.B enable
67Re-enables further playing, and is the opposite of \fBdisable\fR.
68.TP
69.B enabled
70Reports whether playing is enabled. The second field of the response line will
71be \fByes\fR or \fBno\fR.
72.TP
73.B exists \fITRACK\fR
74Reports whether the named track exists. The second field of the response line
75will be \fByes\fR or \fBno\fR.
76.TP
77.B files \fIDIRECTORY\fR [\fIREGEXP\fR]
78Lists all the files in \fIDIRECTORY\fR in a response body.
79If \fIREGEXP\fR is present only matching files are returned.
80.TP
81.B get \fITRACK\fR \fIPREF\fR
82Gets a preference value. On success the second field of the response line will
83have the value.
84.TP
85.B get-global \fIKEY\fR
86Get a global preference.
87.TP
88.B length \fITRACK\fR
89Gets the length of the track in seconds. On success the second field of the
90response line will have the value.
91.TP
92.B log
397ef7bb
RK
93Sends event log messages in a response body. The command will never terminate.
94Any further data sent to the server will be discarded (explicitly; i.e. it will
95not accumulate in a buffer somewhere).
460b9539 96.IP
97See \fBEVENT LOG\fR below for more details.
98.TP
99.B move \fITRACK\fR \fIDELTA\fR
100Move a track in the queue. The track may be identified by ID (preferred) or
101name (which might cause confusion if it's there twice). \fIDELTA\fR should be
102an negative or positive integer and indicates how many steps towards the head
103of the queue the track should be moved.
104.TP
105.B moveafter \fITARGET\fR \fIID\fR ...
106Move 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
108the queue. If \fITARGET\fR is listed in the ID list then the tracks are moved
109to just after the first non-listed track before it, or to the head if there is
110no such track.
111.TP
2a10b70b
RK
112.B new \fR[\fIMAX\fR]
113Sends the most recently added \fIMAX\fR tracks in a response body. If the
114argument is ommitted, all recently added tracks are listed.
115.TP
7858930d 116.B nop
117Do nothing. Used by
118.BR disobedience (1)
119as a keepalive measure.
120.TP
460b9539 121.B part \fITRACK\fR \fICONTEXT\fI \fIPART\fR
122Get a track name part. Returns an empty string if a name part cannot be
123constructed.
124.IP
125.I CONTEXT
126is one of
127.B sort
128or
129.B display
130and
131.I PART
132is usually one of
133.BR artist ,
134.B album
135or
136.BR title .
137.TP
138.B pause
139Pause the current track.
140.TP
141.B play \fITRACK\fR
142Add a track to the queue.
143.TP
144.B playing
145Reports what track is playing.
146.IP
147If the response is \fB252\fR then the rest of the response line consists of
148track information (see below).
149.IP
150If the response is \fB259\fR then nothing is playing.
151.TP
152.B prefs \fBTRACK\fR
153Sends back the preferences for \fITRACK\fR in a response body.
154Each line of the response has the usual line syntax, the first field being the
155name of the pref and the second the value.
156.TP
157.B queue
158Sends back the current queue in a response body, one track to a line, the track
159at the head of the queue (i.e. next to be be played) first. See below for the
160track information syntax.
161.TP
162.B random-disable
163Disable random play (but don't stop the current track).
164.TP
165.B random-enable
166Enable random play.
167.TP
168.B random-enabled
169Reports whether random play is enabled. The second field of the response line
170will be \fByes\fR or \fBno\fR.
171.TP
172.B recent
173Sends back the current recently-played list in a response body, one track to a
174line, the track most recently played last. See below for the track
175information syntax.
176.TP
177.B reconfigure
178Request that DisOrder reconfigure itself. Only trusted users may issue this
179command.
180.TP
181.B remove \fIID\fR
182Remove the track identified by \fIID\fR. If \fBrestrict remove\fR is enabled
183in the server's configuration then only the user that submitted the track may
184remove it.
185.TP
186.B rescan
187Rescan all roots for new or obsolete tracks.
188.TP
189.B resolve \fITRACK\fR
190Resolve a track name, i.e. if this is an alias then return the real track name.
191.TP
192.B resume
193Resume the current track after a \fBpause\fR command.
194.TP
ca831831
RK
195.B rtp-address
196Reports the RTP broadcast (or multicast) address, in the form \fIADDRESS
197PORT\fR.
198.TP
460b9539 199.B scratch \fR[\fIID\fR]
200Remove the track identified by \fIID\fR, or the currently playing track if no
201\fIID\fR is specified. If \fBrestrict scratch\fR is enabled in the server's
202configuration then only the user that submitted the track may scratch it.
203.TP
204.B search \fITERMS\fR
205Search for tracks matching the search terms. The results are put in a response
206body, one to a line.
207.IP
208The search string is split in the usual way, with quoting supported, into a
209list of terms. Only tracks matching all terms are included in the results.
210.IP
211Any terms of the form \fBtag:\fITAG\fR limits the search to tracks with that
212tag.
213.IP
214All other terms are interpreted as individual words which must be present in
215the track name.
216.IP
217Spaces in terms don't currently make sense, but may one day be interpreted to
218allow searching for phrases.
219.TP
220.B \fBset\fR \fITRACK\fR \fIPREF\fR \fIVALUE\fR
221Set a preference.
222.TP
223.B set-global \fIKEY\fR \fIVALUE\fR
224Set a global preference.
225.TP
226.B stats
227Send server statistics in plain text in a response body.
228.TP
229.B \fBtags\fR
230Send the list of currently known tags in a response body.
231.TP
232.B \fBunset\fR \fITRACK\fR \fIPREF\fR
233Unset a preference.
234.TP
235.B \fBunset-global\fR \fIKEY\fR
236Unset a global preference.
237.TP
238.B user \fIUSER\fR \fIRESPONSE\fR
5e3f9e08
RK
239Authenticate as \fIUSER\fR. See
240.B AUTHENTICATION
241below.
460b9539 242.TP
243.B version
244Send back a response with the server version as the second field.
245.TP
246.B volume \fR[\fILEFT\fR [\fIRIGHT\fR]]
247Get or set the volume.
248.IP
249With zero parameters just gets the volume and reports the left and right sides
250as the 2nd and 3rd fields of the response.
251.IP
252With one parameter sets both sides to the same value. With two parameters sets
253each side independently.
254.SH RESPONSES
255Responses are three-digit codes. The first digit distinguishes errors from
256succesful responses:
257.TP
258.B 2
259Operation succeeded.
260.TP
261.B 5
262Operation failed.
263.PP
264The second digit breaks down the origin of the response:
265.TP
266.B 0
267Generic responses not specific to the handling of the command. Mostly this is
268parse errors.
269.TP
270.B 3
271Authentication responses.
272.TP
273.B 5
274Responses specific to the handling of the command.
275.PP
276The third digit provides extra information about the response:
277.TP
278.B 0
279Text part is just commentary.
280.TP
281.B 1
282Text part is a constant result e.g. \fBversion\fR.
283.TP
284.B 2
285Text part is a potentially variable result.
286.TP
287.B 3
288Text part is just commentary; a dot-stuffed body follows.
289.TP
290.B 4
291Text part is just commentary; an indefinite dot-stuffed body follows. (Used
292for \fBlog\fR.)
293.TP
460b9539 294.B 9
295The text part is just commentary (but would normally be a response for this
296command) e.g. \fBplaying\fR.
297.SH AUTHENTICATION
5e3f9e08
RK
298When a connection is made the server sends a \fB231\fR response before any
299command is received. This contains an algorithm name and a challenge encoded
300in hex.
301.PP
302Currently the algorithm name is omitted if it is \fBsha1\fR (but this will
303probably change in a future version). The other options are \fBsha256\fR,
304\fBsha384\fR and \fBsha512\fR. \fBSHA1\fR etc work as synonyms.
460b9539 305.PP
5e3f9e08
RK
306The \fBuser\fR response consists of the selected hash of the user's password
307concatenated with the challenge, encoded in hex.
460b9539 308.SH "TRACK INFORMATION"
309Track information is encoded in a line (i.e. using the usual line syntax) as
310pairs of fields. The first is a name, the second a value. The names have the
311following meanings:
312.TP 12
313.B expected
314The time the track is expected to be played at.
315.TP
316.B id
317A string uniquely identifying this queue entry.
318.TP
319.B played
320The time the track was played at.
321.TP
322.B scratched
323The user that scratched the track.
324.TP
325.B state
326The current track state. Valid states are:
327.RS
328.TP 12
329.B failed
330The player failed (exited with nonzero status but wasn't scratched).
331.TP
332.B isscratch
333The track is actually a scratch.
334.TP
335.B no_player
336No player could be found for the track.
337.TP
338.B ok
339The track was played without any problems.
340.TP
341.B scratched
342The track was scratched.
343.TP
344.B started
345The track is currently playing.
346.TP
347.B unplayed
348In the queue, hasn't been played yet.
349.TP
350.B quitting
351The track was terminated because the server is shutting down.
352.RE
353.TP
354.B submitter
355The user that submitted the track.
356.TP
357.B track
358The filename of the track.
359.TP
360.B when
361The time the track was added to the queue.
362.TP
363.B wstat
364The wait status of the player in decimal.
365.SH NOTES
366Times are decimal integers using the server's \fBtime_t\fR.
367.PP
368For file listings, the regexp applies to the basename of the returned file, not
369the whole filename, and letter case is ignored. \fBpcrepattern\fR(3) describes
370the regexp syntax.
371.PP
372Filenames are in UTF-8 even if the collection they come from uses some other
373encoding - if you want to access the real file (in such cases as the filenames
374actually correspond to a real file) you'll have to convert to whatever the
375right encoding is.
376.SH "EVENT LOG"
377The event log consists of lines starting with a hexadecimal timestamp and a
378keyword followed by (optionally) parameters. The parameters are quoted in the
379usual DisOrder way. Currently the following keywords are used:
380.TP
381.B completed \fITRACK\fR
382Completed playing \fITRACK\fR
383.TP
384.B failed \fITRACK\fR \fIERROR\fR
385Completed playing \fITRACK\fR with an error status
386.TP
387.B moved \fIUSER\fR
388User \fIUSER\fR moved some track(s). Further details aren't included any
389more.
390.TP
391.B playing \fITRACK\fR [\fIUSER\fR]
392Started playing \fITRACK\fR.
393.TP
394.B queue \fIQUEUE-ENTRY\fR...
395Added \fITRACK\fR to the queue.
396.TP
397.B recent_added \fIQUEUE-ENTRY\fR...
398Added \fIID\fR to the recently played list.
399.TP
400.B recent_removed \fIID\fR
401Removed \fIID\fR from the recently played list.
402.TP
403.B removed \fIID\fR [\fIUSER\fR]
404Queue 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).
406.TP
e025abff
RK
407.B rescanned
408A rescan completed.
409.TP
460b9539 410.B scratched \fITRACK\fR \fIUSER\fR
411\fITRACK\fR was scratched by \fIUSER\fR.
412.TP
413.B state \fIKEYWORD\fR
414Some state change occurred. The current set of keywords is:
415.RS
416.TP
5abe307a
RK
417.B completed
418The current track completed successfully.
419.TP
460b9539 420.B disable_play
421Playing was disabled.
422.TP
423.B disable_random
424Random play was disabled.
425.TP
426.B enable_play
427Playing was enabled.
428.TP
429.B enable_random
430Random play was enabled.
431.TP
5abe307a
RK
432.B failed
433The current track failed.
434.TP
460b9539 435.B pause
436The current track was paused.
437.TP
5abe307a
RK
438.B playing
439A track started playing.
440.TP
460b9539 441.B resume
442The current track was resumed.
5abe307a
RK
443.TP
444.B scratched
445The current track was scratched.
446.PP
447To simplify client implementation, \fBstate\fR commands reflecting the current
448state are sent at the start of the log.
460b9539 449.RE
450.TP
451.B volume \fILEFT\fR \fIRIGHT\fR
452The volume changed.
453.PP
454.IR QUEUE-ENTRY ...
455is as defined in
456.B "TRACK INFORMATION"
457above.
458.SH "SEE ALSO"
459\fBdisorder\fR(1),
460\fBtime\fR(2),
461\fBdisorder\fR(3),
462\fBpcrepattern\fR(3)
463\fBdisorder_config\fR(5),
464\fBdisorderd\fR(8),
465\fButf8\fR(7)
466.\" Local Variables:
467.\" mode:nroff
468.\" fill-column:79
469.\" End: