chiark / gitweb /
add "users" command
[disorder] / doc / disorder_config.5.in
CommitLineData
460b9539 1.\"
405fea4e 2.\" Copyright (C) 2004, 2005, 2006, 2007 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_config 5
20.SH NAME
21pkgconfdir/config - DisOrder jukebox configuration
22.SH DESCRIPTION
23The purpose of DisOrder is to organize and play digital audio files, under the
24control of multiple users. \fIpkgconfdir/config\fR is the primary
25configuration file but this man page currently documents all of its various
26configuration files.
27.SS Tracks
28DisOrder can be configured with multiple collections of tracks, indexing them
29by their filename, and picking players on the basis of filename patterns (for
30instance, "*.mp3").
31.PP
32Although the model is of filenames, it is not inherent that there are
33corresponding real files - merely that they can be interpreted by the chosen
34player. See \fBdisorder\fR(3) for more details about this.
35.PP
36Each track can have a set of preferences associated with it. These are simple
37key-value pairs; they can be used for anything you like, but a number of keys
38have specific meanings. See \fBdisorder\fR(1) for more details about these.
39.SS "Track Names"
40Track names are derived from filenames under the control of regular
41expressions, rather than attempting to interpret format-specific embedded name
42information. They can be overridden by setting preferences.
43.PP
44Names for display are distinguished from names for sorting, so with the right
45underlying filenames an album can be displayed in its original order even if
46the displayed track titles are not lexically sorted.
47.SS "Server State"
48A collection of global preferences define various bits of server state: whether
49random play is enabled, what tags to check for when picking at random, etc.
50.SS "Users And Access Control"
51DisOrder distinguishes between multiple users. This is for access control and
52reporting, not to provide different views of the world: i.e. preferences and so
53on are global.
54.PP
55It's possible to restrict a small number of operations to a specific subset of
56users. However, it is assumed that every user is supposed to be able to do
57most operations - since the users are all sharing the same audio environment
58they are expected to cooperate with each other.
59.PP
60Access control is entirely used-based. If you configure DisOrder to listen for
61TCP/IP connections then it will accept a connection from anywhere provided the
62right password is available. Passwords are never transmitted over TCP/IP
63connections in clear, but everything else is. The expected model is that
64host-based access control is imposed at the network layer.
65.SS "Web Interface"
66The web interface is controlled by a collection of template files, one for each
67kind of page, and a collection of option files. These are split up and
68separate from the main configuration file to make it more convenient to
69override specific bits.
70.PP
71The web interface connects to the DisOrder server like any other user, though
72it is given a special privilege to "become" any other user. (Thus, any process
73with the same UID as the web interface is very powerful as far as DisOrder
25ca855b 74goes. This model will be changed in a future version.)
460b9539 75.PP
76Access control to the web interface is (currently) separate from DisOrder's own
77access control (HTTP authentication is required) but uses the same user
78namespace.
180dcdb0
RK
79.SS "Searching And Tags"
80Search strings contain a list of search terms separated by spaces. A search
81term can either be a single word or a tag, prefixed with "tag:".
82.PP
83Search words are compared without regard to letter case or accents; thus, all
84of the following will be considered to be equal to one another:
85.PP
86.nf
87 LATIN CAPITAL LETTER E
88 LATIN SMALL LETTER E
89 LATIN CAPITAL LETTER E WITH GRAVE
90 LATIN SMALL LETTER E WITH GRAVE
91 LATIN CAPITAL LETTER E plus COMBINING GRAVE ACCENT
92 LATIN SMALL LETTER E plus COMBINING GRAVE ACCENT
93.fi
94.PP
95The same rules apply to tags but in addition leading and trailing whitespace is
96disregarded and all whitespace sequences are treated as equal when they appear
97as internal whitespace.
98.PP
99Where several tags are listed, for instance the tags preference for a track,
100the tags are separated by commas. Therefore tags may not contain commas.
460b9539 101.SH "CONFIGURATION FILE"
102.SS "General Syntax"
103Lines are split into fields separated by whitespace (space, tab, line
104feed, carriage return, form feed). Comments are started by the number
105sign ("#").
106.PP
107Fields may be unquoted (in which case they may not contain spaces and
108may not start with a quotation mark or apostrophe) or quoted by either
109quotation marks or apostrophes. Inside quoted fields every character
110stands for itself, except that a backslash can only appear as part of
111one of the following escape sequences:
112.TP
113.B \e\e
114Backslash
115.TP
116.B \e"
117Quotation mark
118.\" "
119.TP
120.B \e'
121Apostrophe
122.TP
123.B \en
124Line feed
125.PP
126No other escape sequences are allowed.
127.PP
128Within any line the first field is a configuration command and any
129further fields are parameters. Lines with no fields are ignored.
130.PP
131After editing the config file use \fBdisorder reconfigure\fR to make
132it re-read it. If there is anything wrong with it the daemon will
133record a log message and ignore the new config file. (You should fix
134it before next terminating and restarting the daemon, as it cannot
135start up without a valid config file.)
136.SS "Global Configuration"
137.TP
138.B home \fIDIRECTORY\fR
139The home directory for state files. Defaults to
140.IR pkgstatedir .
659d87e8 141The server will create this directory on startup if it does not exist.
460b9539 142.TP
0c6bcae0 143.B plugins \fIPATH\fR
460b9539 144Adds a directory to the plugin path. (This is also used by the web
145interface.)
146.IP
147Plugins are opened the first time they are required and never after,
148so after changing a plugin you must restart the server before it is
149guaranteed to take effect.
40c30921
RK
150.IP
151If
152.B plugins
153is used without arguments the plugin path is cleared.
460b9539 154.SS "Server Configuration"
155.TP
156.B alias \fIPATTERN\fR
157Defines the pattern use construct virtual filenames from \fBtrackname_\fR
158preferences.
159.IP
160Most characters stand for themselves, the exception being \fB{\fR which is used
161to insert a track name part in the form \fB{\fIname\fB}\fR or
162\fB{/\fIname\fB}\fR.
163.IP
164The difference is that the first form just inserts the name part while the
165second prefixes it with a \fB/\fR if it is nonempty.
166.IP
167The pattern should not attempt to include the collection root, which is
168automatically included, but should include the proper extension.
169.IP
170The default is \fB{/artist}{/album}{/title}{ext}\fR.
171.TP
25ca855b 172.B authorization_algorithm \fIALGORITHM\fR
637fdea3
RK
173Defines the algorithm used to authenticate clients. The valid options
174are sha1 (the default), sha256, sha384 and sha512. See
175.BR disorder_protocol (5)
176for more details.
177.TP
30ad4dab 178.B broadcast \fIADDRESS\fR \fIPORT\fR
179Transmit sound data to \fIADDRESS\fR using UDP port \fIPORT\fR. This implies
29573477 180\fBspeaker_backend network\fR.
61941295
RK
181.IP
182See also \fBmulticast_loop\fR and \fBmulticast_ttl\fR.
30ad4dab 183.TP
184.B broadcast_from \fIADDRESS\fR \fIPORT\fR
185Sets the (local) source address used by \fBbroadcast\fR.
186.TP
460b9539 187.B channel \fICHANNEL\fR
188The mixer channel that the volume control should use. Valid names depend on
189your operating system and hardware, but some standard ones that might be useful
190are:
191.RS
192.TP 8
193.B pcm
25ca855b
RK
194Output level for the audio device. This is probably what you want and is the
195default.
460b9539 196.TP
197.B speaker
198Output level for the PC speaker, if that is connected to the sound card.
199.TP
200.B pcm2
201Output level for alternative codec device.
202.TP
203.B vol
204Master output level. The OSS documentation recommends against using this, as
205it affects all output devices.
206.RE
207.IP
25ca855b
RK
208You can also specify channels by number, if you know the right value. NB that
209volume setting only works on OSS systems (including ALSA, via emulation).
460b9539 210.TP
211.B collection \fIMODULE\fR \fIENCODING\fR \fIROOT\fR
212Define a collection of tracks.
213.IP
214\fIMODULE\fR defines which plugin module should be used for this
215collection. Use the supplied \fBfs\fR module for tracks that exists
216as ordinary files in the filesystem.
217.IP
218\fIENCODING\fR defines the encoding of filenames in this collection.
219For \fBfs\fR this would be the encoding you use for filenames.
220Examples might be \fBiso-8859-1\fR or \fButf-8\fR.
221.IP
222\fIROOT\fR is the root in the filesystem of the filenames and is
223passed to the plugin module.
224.TP
225.B device \fINAME\fR
226ALSA device to play raw-format audio. Default is \fBdefault\fR, i.e. to use
227the whatever the ALSA configured default is.
228.TP
229.B gap \fISECONDS\fR
230Specifies the number of seconds to leave between tracks. The default
231is 2.
232.TP
233.B history \fIINTEGER\fR
234Specifies the number of recently played tracks to remember (including
235failed tracks and scratches).
236.TP
237.B listen \fR[\fIHOST\fR] \fISERVICE\fR
238Listen for connections on the address specified by \fIHOST\fR and port
239specified by \fISERVICE\fR. If \fIHOST\fR is omitted then listens on all
240local addresses.
241.IP
242Normally the server only listens on a UNIX domain socket.
243.TP
244.B lock yes\fR|\fBno
245Determines whether the server locks against concurrent operation. Default is
25ca855b
RK
246\fByes\fR. There is no good reason to set this to \fBno\fR and the option will
247probably be removed in a future version.
460b9539 248.TP
249.B mixer \fIPATH\fR
250The path to the mixer device, if you want access to the volume control,
25ca855b 251e.g. \fB/dev/mixer\fR (the default).
460b9539 252.TP
61941295
RK
253.B multicast_loop yes\fR|\fBno
254Determines whether multicast packets are loop backed to the sending host. The
255default is \fByes\fR. This only applies if
256\fBspeaker_backend\fR is set to \fBnetwork\fR and \fBbroadcast\fR is actually a
257multicast address.
258.TP
23205f9c 259.B multicast_ttl \fIHOPS\fR
61941295 260Set the maximum number of hops to send multicast packets. This only applies if
23205f9c 261\fBspeaker_backend\fR is set to \fBnetwork\fR and \fBbroadcast\fR is actually a
25ca855b 262multicast address. The default is 1.
23205f9c 263.TP
460b9539 264.B namepart \fIPART\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
265Determines how to extract trackname part \fIPART\fR from a
266track name (with the collection root part removed).
267Used in \fB@recent@\fR, \fB@playing@\fR and \fB@search@\fR.
268.IP
269Track names can be different in different contexts. For instance the sort
270string might include an initial track number, but this would be stripped for
271the display string. \fICONTEXT\fR should be a glob pattern matching the
272contexts in which this directive will be used.
273.IP
274Valid contexts are \fBsort\fR and \fBdisplay\fR.
275.IP
276All the \fBnamepart\fR directives are considered in order. The
277first directive for the right part, that matches the desired context,
278and with a \fIREGEXP\fR that
279matches the track is used, and the value chosen is constructed from
280\fISUBST\fR according to the substitution rules below.
281.IP
282Note that searches use the raw track name and \fBtrackname_\fR preferences but
283not (currently) the results of \fBnamepart\fR, so generating words via this option
284that aren't in the original track name will lead to confusing results.
285.IP
286If you supply no \fBnamepart\fR directives at all then a default set will be
287supplied automatically. But if you supply even one then you must supply all of
25ca855b
RK
288them. The defaults are equivalent to:
289.PP
290.nf
291namepart title "/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
292namepart title "/([^/]+)\\.[a-zA-Z0-9]+$" $1 sort
293namepart album "/([^/]+)/[^/]+$" $1 *
294namepart artist "/([^/]+)/[^/]+/[^/]+$" $1 *
295namepart ext "(\\.[a-zA-Z0-9]+)$" $1 *
296.fi
460b9539 297.TP
298.B nice_rescan \fIPRIORITY\fR
299Set the recan subprocess priority. The default is 10.
300.IP
301(Note that higher values mean the process gets less CPU time; UNIX priority
04e42396 302values are backwards.)
460b9539 303.TP
304.B nice_server \fIPRIORITY\fR
305Set the server priority. This is applied to the server at startup time (and
306not when you reload configuration). The server does not use much CPU itself
307but this value is inherited by programs it executes. If you have limited CPU
308then it might help to set this to a small negative value. The default is 0.
309.TP
310.B nice_speaker \fIPRIORITY\fR
311Set the speaker process priority. This is applied to the speaker process at
312startup time (and not when you reload the configuration). The speaker process
313is not massively CPU intensive by today's standards but depends on reasonably
314timely scheduling. If you have limited CPU then it might help to set this to a
315small negative value. The default is 0.
316.TP
2a10b70b
RK
317.B noticed_history
318The maximum days that a track can survive in the database of newly added
319tracks. The default is 31.
320.TP
460b9539 321.B player \fIPATTERN\fR \fIMODULE\fR [\fIOPTIONS.. [\fB--\fR]] \fIARGS\fR...
322Specifies the player for files matching the glob \fIPATTERN\fR. \fIMODULE\fR
323specifies which plugin module to use.
324.IP
325The following options are supported:
326.RS
327.TP
328.B --wait-for-device\fR[\fB=\fIDEVICE\fR]
329Waits (for up to a couple of seconds) for the default, or specified, libao
330device to become openable.
331.TP
332.B --
333Defines the end of the list of options. Needed if the first argument to the
334plugin starts with a "-".
335.RE
336.IP
337The following are the standard modules:
338.RS
339.TP
340.B exec \fICOMMAND\fR \fIARGS\fR...
341The command is executed via \fBexecvp\fR(3), not via the shell.
342The \fBPATH\fR environment variable is searched for the executable if it is not
343an absolute path.
344The command is expected to know how to open its own sound device.
345.TP
346.B execraw \fICOMMAND\fR \fIARGS\fR...
347Identical to the \fBexec\fR except that the player is expected to use the
ce6c36be 348DisOrder raw player protocol.
349.BR disorder-decode (8)
350can decode several common audio file formats to this format. If your favourite
351format is not supported, but you have a player which uses libao, there is also
352a libao driver which supports this format; see below for more information about
353this.
460b9539 354.TP
355.B shell \fR[\fISHELL\fR] \fICOMMAND\fR
356The command is executed using the shell. If \fISHELL\fR is specified then that
357is used, otherwise \fBsh\fR will be used. In either case the \fBPATH\fR
358environment variable is searched for the shell executable if it is not an
359absolute path. The track name is stored in the environment variable
360\fBTRACK\fR.
361.IP
362Be careful of the interaction between the configuration file quoting rules and
363the shell quoting rules.
364.RE
365.IP
366If multiple player commands match a track then the first match is used.
62dc3748
RK
367.IP
368For the server to be able to calculate track lengths, there should be a
369.B tracklength
370command corresponding to each
371.B player
372command.
40c30921
RK
373.IP
374If
375.B player
376is used without arguments, the list of players is cleared.
460b9539 377.TP
378.B prefsync \fISECONDS\fR
379The interval at which the preferences log file will be synchronised. Defaults
380to 3600, i.e. one hour.
381.TP
459d4402 382.B queue_pad \fICOUNT\fR
383The target size of the queue. If random play is enabled then randomly picked
25ca855b 384tracks will be added until the queue is at least this big. The default is 10.
459d4402 385.TP
62dc3748
RK
386.B restrict \fR[\fBscratch\fR] [\fBremove\fR] [\fBmove\fR]
387Determine which operations are restricted to the submitter of a
388track. By default, no operations are restricted, i.e. anyone can
389scratch or remove anything.
390.IP
391If \fBrestrict scratch\fR or \fBrestrict remove\fR are set then only the user
392that submitted a track can scratch or remove it, respectively.
393.IP
394If \fBrestrict move\fR is set then only trusted users can move tracks around in
395the queue.
396.IP
397If \fBrestrict\fR is used more than once then only the final use has any
398effect.
399.TP
405fea4e 400.B sample_format \fIBITS\fB/\fIRATE\fB/\fICHANNELS
401Describes the sample format expected by the \fBspeaker_command\fR (below). The
402components of the format specification are as follows:
403.RS
404.TP 10
405.I BITS
406The number of bits per sample. Optionally, may be suffixed by \fBb\fR or
407\fBl\fR for big-endian and little-endian words. If neither is used the native
408byte order is assumed.
409.TP
410.I RATE
411The number of samples per second.
412.TP
413.I CHANNELS
414The number of channels.
415.PP
416The default is
417.BR 16/44100/2 .
937be4c0
RK
418.PP
419With the
420.B network
421backend the sample format is forced to
e99d42b1 422.B 16b/44100/2
937be4c0
RK
423and with the
424.B coreaudio
425backend it is forced to
426.BR 16/44100/2 ,
427in both cases regardless of what is specified in the configuration file.
405fea4e 428.RE
429.TP
460b9539 430.B signal \fINAME\fR
431Defines the signal to be sent to track player process groups when tracks are
432scratched. The default is \fBSIGKILL\fR.
433.IP
434Signals are specified by their full C name, i.e. \fBSIGINT\fR and not \fBINT\fR
435or \fBInterrupted\fR or whatever.
436.TP
29573477 437.B speaker_backend \fINAME\fR
438Selects the backend use by the speaker process. The following options are
439available:
440.RS
441.TP
442.B alsa
443Use the ALSA API. This is only available on Linux systems, on which it is the
444default.
445.TP
937be4c0
RK
446.B coreaudio
447Use Apple Core Audio. This only available on OS X systems, on which it is the
448default.
449.TP
e99d42b1 450.B oss
25ca855b 451Use the OSS (/dev/dsp) API. Not available on all platforms.
e99d42b1 452.TP
29573477 453.B command
454Execute a command. This is the default if
455.B speaker_command
937be4c0 456is specified, or if no native is available.
29573477 457.TP
458.B network
459Transmit audio over the network. This is the default if
803f6e52 460\fBbroadcast\fR is specified. You can use
461.BR disorder-playrtp (1)
462to receive and play the resulting stream on Linux and OS X.
29573477 463.RE
464.TP
5330d674 465.B sox_generation \fB0\fR|\fB1
466Determines whether calls to \fBsox\fR(1) should use \fB-b\fR, \fB-x\fR, etc (if
25ca855b
RK
467the generation is 0) or \fB-\fIbits\fR, \fB-L\fR etc (if it is 1). See the
468documentation for your installed copy of \fBsox\fR to determine which you need.
469The default is 0.
5330d674 470.TP
405fea4e 471.B speaker_command \fICOMMAND
472Causes the speaker subprocess to pipe audio data into shell command
473\fICOMMAND\fR, rather than writing to a local sound card. The sample format is
474determine by
475.B sample_format
476above.
77cfc7a2 477.IP
478Note that if the sample format is wrong then
479.BR sox (1)
480is invoked to translate it. If
481.B sox
482is not installed then this will not work.
405fea4e 483.TP
460b9539 484.B scratch \fIPATH\fR
485Specifies a scratch. When a track is scratched, a scratch track is
486played at random.
487Scratches are played using the same logic as other tracks.
488.IP
489At least for the time being, path names of scratches must be encoded using
490UTF-8 (which means that ASCII will do).
40c30921
RK
491.IP
492If \fBscratch\fR is used without arguments then the list of scratches is
493cleared.
460b9539 494.TP
495.B stopword \fIWORD\fR ...
496Specifies one or more stopwords that should not take part in searches
497over track names.
40c30921
RK
498.IP
499If \fBstopword\fR is used without arguments then the list of stopwords is
500cleared.
62dc3748
RK
501.TP
502.B tracklength \fIPATTERN\fR \fIMODULE\fR
503Specifies the module used to calculate the length of files matching
504\fIPATTERN\fR. \fIMODULE\fR specifies which plugin module to use.
40c30921
RK
505.IP
506If \fBtracklength\fR is used without arguments then the list of modules is
507cleared.
460b9539 508.SS "Client Configuration"
509.TP
ccf0aafa 510.B connect \fIHOST SERVICE\fR
460b9539 511Connect to the address specified by \fIHOST\fR and port specified by
ccf0aafa 512\fISERVICE\fR.
460b9539 513.SS "Web Interface Configuration"
514.TP
515.B refresh \fISECONDS\fR
516Specifies the maximum refresh period in seconds. Default 15.
517.TP
61507e3c
RK
518.B short_display \fICHARACTERS\fR
519Defines the maximum number of characters to include in a \fBshort\fR name
520part. Default 30.
521.TP
460b9539 522.B templates \fIPATH\fR ...
523Specifies the directory containing templates used by the web
524interface. If a template appears in more than one template directory
525then the one in the earliest directory specified is chosen.
526.IP
527See below for further details.
40c30921
RK
528.IP
529If \fBtemplates\fR is used without arguments then the template path is cleared.
460b9539 530.TP
531.B transform \fITYPE\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
532Determines how names are sorted and displayed in track choice displays.
533.IP
534\fITYPE\fR is the type of transformation; usually \fBtrack\fR or
535\fBdir\fR but you can define your own.
536.IP
537\fICONTEXT\fR is a glob pattern matching the context. Standard contexts are
538\fBsort\fR (which determines how directory names are sorted) and \fBdisplay\fR
539(which determines how they are displayed). Again, you can define your
540own.
541.IP
542All the \fBtransform\fR directives are considered in order. If
543the \fITYPE\fR, \fIREGEXP\fR and the \fICONTEXT\fR match
544then a new track name is constructed from
545\fISUBST\fR according to the substitution rules below. If several
546match then each is executed in order.
547.IP
548If you supply no \fBtransform\fR directives at all then a default set will be
549supplied automatically. But if you supply even one then you must supply all of
25ca855b
RK
550them. The defaults are:
551.PP
552.nf
553transform track "^.*/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
554transform track "^.*/([^/]+)\\.[a-zA-Z0-9]+$" $1 sort
555transform dir "^.*/([^/]+)$" $1 *
556transform dir "^(the) ([^/]*)" "$2 $1" sort i
557transform dir "[[:punct:]]" "" sort g
558.fi
460b9539 559.TP
560.B url \fIURL\fR
561Specifies the URL of the web interface. This URL will be used in
562generated web pages.
563.IP
564This must be the full URL, e.g. \fBhttp://myhost/cgi-bin/jukebox\fR and not
565\fB/cgi-bin/jukebox\fR.
566.SS "Authentication Configuration"
567.TP
460b9539 568.B password \fIPASSWORD\fR
569Specify password.
570.TP
571.B trust \fIUSERNAME\fR
572Allow \fIUSERNAME\fR to perform privileged operations such as shutting
573down or reconfiguring the daemon, or becoming another user.
40c30921
RK
574.IP
575If \fBtrust\fR is used without arguments then the list of trusted users is
576cleared.
460b9539 577.TP
578.B user \fIUSER\fR
579Specifies the user to run as. Only makes sense if invoked as root (or
580the target user).
581.TP
582.B username \fIUSERNAME\fR
583Specify username. The default is taken from the environment variable
584\fBLOGNAME\fR.
585.PP
586Configuration files are read in the following order:
587.TP
588.I pkgconfdir/config
589.TP
590.I pkgconfdir/config.private
591Should be readable only by the jukebox group, and contain \fBallow\fR
592commands for authorised users.
36be7e6a
RK
593.IP
594If this file does not exist at startup then the server will create it with a
595randomly chosen password for the root user.
460b9539 596.TP
597.I pkgconfdir/config.\fRUSER
598Per-user system-controlled client configuration. Optional but if it
599exists must be readable only by the relevant user. Would normally
600contain a \fBpassword\fR directive.
601.TP
602.I ~\fRUSER\fI/.disorder/passwd
603Per-user client configuration. Optional but if it exists must be
604readable only by the relevant user. Would normally contain a
605\fBpassword\fR directive.
606.SH "GLOBAL PREFERENCES"
607These are the values set with \fBset-global\fR.
608.TP
609.B required-tags
610If this is set an nonempty then randomly played tracks will always have at
611least one of the listed tags.
460b9539 612.TP
613.B prohibited-tags
614If this is set an nonempty then randomly played tracks will never have any of
615the listed tags.
616.TP
617.B playing
618If unset or \fByes\fR then play is enabled. Otherwise it is disabled. Use
619\fBdisable\fR rather than setting it directly.
620.TP
621.B random-play
622If unset or \fByes\fR then random play is enabled. Otherwise it is disabled.
623Use \fBdisable\fR rather than setting it directly.
f9635e06
RK
624.PP
625Global preferences starting '_' are read-only (in the sense that you cannot
626modify them; the server may modify them as part of its normal operation). They
627are:
628.TP
629.B _dbversion
630The database version string. This is used by DisOrder to detect when it must
631modify the database after an upgrade.
460b9539 632.SH "LIBAO DRIVER"
633.SS "Raw Protocol Players"
634Raw protocol players are expected to use the \fBdisorder\fR libao driver.
635Programs that use libao generally have command line options to select the
636driver and pass options to it.
637.SS "Driver Options"
638The known driver options are:
639.TP
640.B fd
641The file descriptor to write to. If this is not specified then the driver
642looks like the environment variable \fBDISORDER_RAW_FD\fR. If that is not set
643then the default is 1 (i.e. standard output).
644.TP
645.B fragile
646If this is set to a nonzero value then the driver will call \fB_exit\fR(2) if a
647write to the output file descriptor fails. This is a workaround for buggy
648players such as \fBogg123\fR that ignore write errors.
649.SH "WEB TEMPLATES"
650When \fBdisorder.cgi\fR wants to generate a page for an action it searches the
651directories specified with \fBtemplates\fR for a matching file. It is
652suggested that you leave the distributed templates unchanged and put
653any customisations in an earlier entry in the template path.
654.PP
655The supplied templates are:
656.TP
657.B about.html
658Display information about DisOrder.
659.TP
660.B choose.html
661Navigates through the track database to choose a track to play. The
662\fBdir\fR argument gives the directory to look in; if it is missing
663then the root directory is used.
664.TP
665.B choosealpha.html
666Provides a front end to \fBchoose.html\fR which allows subsets of the top level
667directories to be selected by initial letter.
668.TP
d5b6ffd7
RK
669.B new.html
670Lists newly added tracks.
671.TP
460b9539 672.B playing.html
673The "front page", which usually shows the currently playing tracks and
674the queue.
675Gets an HTTP \fBRefresh\fR header.
676.IP
677If the \fBmgmt\fR CGI argument is set to \fBtrue\fR then we include extra
678buttons for moving tracks up and down in the queue. There is some logic in
679\fBdisorder.cgi\fR to ensure that \fBmgmt=true\fR is preserved across refreshes
680and redirects back into itself, but URLs embedded in web pages must include it
681explicitly.
682.TP
683.B prefs.html
684Views preferences. If the \fBfile\fR, \fBname\fR and \fBvalue\fR arguments are
685all set then that preference is modified; if \fBfile\fR and \fBname\fR are set
686but not \fBvalue\fR then the preference is deleted.
687.TP
688.B recent.html
689Lists recently played tracks.
690.TP
691.B search.html
692Presents search results.
693.TP
694.B volume.html
695Primitive volume control.
696.PP
697Additionally, other standard files are included by these:
698.TP
699.B credits.html
700Included at the end of the main content \fB<DIV>\fR element.
701.TP
d5b6ffd7
RK
702.B topbar.html
703Included at the start of the \fB<BODY>\fR element. (This supplants
704\fBsidebar.html\fR, though the latter is still available; override label
705\fBmenu\fR to choose between them.)
460b9539 706.TP
707.B stdhead.html
708Included in the \fB<HEAD>\fR element.
709.TP
710.B stylesheet.html
711Contains the default DisOrder stylesheet. You can override this by editing the
712CSS or by replacing it all with a \fB<LINK>\fR to an external stylesheet.
713.PP
714Templates are ASCII files containing HTML documents, with an expansion
715syntax to enable data supplied by the implementation to be inserted.
716.PP
717If you want to use characters outside the ASCII range, use either the
718appropriate HTML entity, e.g. \fB&eacute;\fR, or an SGML numeric
719character reference, e.g. \fB&#253;\fR. Use \fB&#64;\fR to insert a
720literal \fB@\fR without falling foul of the expansion syntax.
721.SS "Expansion Syntax"
722Expansions are surrounded by at ("@") symbols take the form of a keyword
723followed by zero or more arguments. Arguments may either be quoted by curly
724brackets ("{" and "}") or separated by colons (":"). Both kinds may be mixed
725in a single expansion, though doing so seems likely to cause confusion.
726The descriptions below contain suggested forms for each
727expansion.
728.PP
729Leading and trailing whitespace in unquoted arguments is ignored, as is
730whitespace (including newlines) following a close bracket ("}").
731.PP
732Arguments are recursively expanded before being interpreted, except for
733\fITEMPLATE\fR arguments. These are expanded (possibly more than once) to
734produce the final expansion.
735(More than once means the same argument being expanded more than once
736for different tracks or whatever, not the result of the first
737expansion itself being re-expanded.)
738.PP
739Strings constructed by expansions (i.e. not literally copied from the template
740text) are SGML-quoted: any character which does not stand for itself in #PCDATA
741or a quoted attribute value is replaced by the appropriate numeric character
742reference.
743.PP
744The exception to this is that such strings are \fInot\fR quoted when they are
745generated in the expansion of a parameter.
746.PP
747In the descriptions below, the current track means the one set by
748\fB@playing@\fR, \fB@recent@\fR or \fB@queue@\fR, not the one that is playing.
749If none of these expansions are in force then there is no current track.
750\fIBOOL\fR should always be either \fBtrue\fR or \fBfalse\fR.
751.SS "Expansions"
752The following expansion keywords are defined:
753.TP
754.B @#{\fICOMMENT\fB}@
755Ignored.
756.TP
757.B @action@
758The current action. This reports
759.B manage
760if the action is really
761.B playing
762but
763.B mgmt=true
764was set.
765.TP
766.B @and{\fIBOOL\fB}{\fIBOOL\fB}\fR...\fB@
767If there are no arguments, or all the arguments are \fBtrue\fB, then expands to
768\fBtrue\fR, otherwise to \fBfalse\fR.
769.TP
770.B @arg:\fINAME\fB@
25ca855b 771Expands to the value of CGI argument \fINAME\fR.
460b9539 772.TP
773.B @basename@
774The basename of the current directory component, in \fB@navigate@\fR.
775.TP
776.B @basename{\fIPATH\fB}@
777The base name part of \fIPATH\fR.
778.TP
779.B @choose{\fIWHAT\fB}{\fITEMPLATE\fB}@
780Expands \fITEMPLATE\fR repeatedly for each file or directory under
781\fB@arg:directory@\fR.
782\fIWHAT\fR should be either \fBfile\fR or \fBdirectory\fR.
783Use \fB@file@\fR to get the display name or filename of the file or
784directory.
785Usually used in \fBchoose.html\fR.
786.TP
787.B @dirname@
788The directory of the current directory component, in \fB@navigate@\fR.
789.TP
790.B @dirname{\fIPATH\fB}@
791The directory part of \fIPATH\fR.
792.TP
793.B @enabled@
794Expands to \fBtrue\fR if play is currently enabled, otherwise to \fBfalse\fR.
795.TP
796.B @eq{\fIA\fB}{\fIB\fB}
797Expands to \fBtrue\fR if \fIA\fR and \fIB\fR are identical, otherwise to
798\fBfalse\fR.
799.TP
800.B @file@
801Expands to the filename of the current file or directory, inside the template
802argument to \fBchoose\fR.
803.TP
804.B @files{\fITEMPLATE\fB}
40c30921 805Expands \fITEMPLATE\fR once for each file indicated by the \fBdirectory\fR CGI
460b9539 806arg if it is present, or otherwise for the list of files counted by \fBfiles\fR
807with names \fB0_file\fR, \fB1_file\fR etc.
808.TP
809.B @fullname@
810The full path of the current directory component, in \fB@navigate@\fR.
811.TP
812.B @id@
813The ID of the current track.
814.TP
815.B @if{\fIBOOL\fB}{\fITRUEPART\fB}{\fIFALSEPART\fB}@
816If \fIBOOL\fR expands to \fBtrue\fR then expands to \fITRUEPART\fR, otherwise
817to \fIFALSEPART\fR (which may be omitted).
818.TP
819.B @include:\fIPATH\fR@
820Include the named file as if it were a template file. If \fIPATH\fR
821starts with a \fB/\fR then it is used as-is; otherwise, ".html" is
822appended and the template path is searched.
823.TP
824.B @index@
825Expands to the index of the current file in \fB@queue@\fR, \fB@recent@\fR or
826\fB@files@\fR.
827.TP
828.B @isdirectories@
829Expands to \fBtrue\fR if there are any directories in \fB@arg:directory@\fR,
830otherwise to \fBfalse\fR.
831.TP
832.B @isfiles@
833Expands to \fBtrue\fR if there are any files in \fB@arg:directory@\fR,
834otherwise to \fBfalse\fR.
835.TP
836.B @isfirst@
837Expands to \fBtrue\fR if this is the first repetition of a \fITEMPLATE\fR
838argument in a loop (\fB@queue\fR or similar), otherwise to \fBfalse\fR.
839.TP
840.B @islast@
841Expands to \fBtrue\fR if this is the last repetition of a \fITEMPLATE\fR in a
842loop, otherwise to \fBfalse\fR.
843.TP
d5b6ffd7
RK
844.B @isnew@
845Expands to \fBtrue\fR if the newly added tracks list has any tracks in it,
846otherwise to \fBfalse\fR.
847.TP
460b9539 848.B @isplaying@
849Expands to \fBtrue\fR if a track is playing, otherwise to \fBfalse\fR.
850.TP
851.B @isqueue@
852Expands to \fBtrue\fR if there are any tracks in the queue, otherwise to
853\fBfalse\fR.
854.TP
855.B @isrecent@
856Expands to \fBtrue\fR if the recently played list has any tracks in it,
857otherwise to \fBfalse\fR.
858.TP
859.B @label:\fINAME\fR\fB@
860Expands to the value of label \fINAME\fR. See the shipped \fIoptions.labels\fR
861file for full documentation of the labels used by the standard templates.
862.TP
863.B @length@
864Expands to the length of the current track.
865.TP
866.B @navigate{\fIDIRECTORY\fB}{\fITEMPLATE\fB}
867Expands \fITEMPLATE\fR for each component of \fIDIRECTORY\fR in turn.
868Use \fB@dirname\fR and \fB@basename@\fR to get the components of the path to
869each component.
870Usually used in \fBchoose.html\fR.
871.TP
872.B @ne{\fIA\fB}{\fIB\fB}
873Expands to \fBtrue\fR if \fIA\fR and \fIB\fR differ, otherwise to \fBfalse\fR.
874.TP
d5b6ffd7
RK
875.B @new{\fITEMPLATE\fB}
876Expands \fITEMPLATE\fR for each track in the newly added tracks list, starting
877with the most recent. Used in \fBnew.html\fR.
878.TP
460b9539 879.B @nfiles@
880Expands to the number of files from \fB@files\fR (above).
881.TP
882.B @nonce@
883Expands to a string including the time and process ID, intended to be
884unique across invocations.
885.TP
886.B @not{\fIBOOL\fB}@
887Expands to \fBfalse\fR if \fIBOOL\fR is \fBtrue\fR, otherwise to
888\fBfalse\fR.
889.TP
890.B @or{\fIBOOL\fB}{\fIBOOL\fB}\fR...\fB@
891If at least one argument is \fBtrue\fB, then expands to \fBtrue\fR, otherwise
892to \fBfalse\fR.
893.TP
894.B @parity@
895Expands to \fBeven\fR or \fBodd\fR depending on whether the current track is at
896an even or odd position in \fB@queue@\fR, \fB@recent@\fR or \fB@files@\fR.
897.TP
898.B @part{\fICONTEXT\fB}{\fIPART\fB}@
899Expands to track name part \fIPART\fR using context \fICONTEXT\fR for the
61507e3c 900current track. The context may be omitted and defaults
460b9539 901to \fBdisplay\fR.
61507e3c
RK
902.IP
903The special context \fBshort\fR is equivalent to \fBdisplay\fR but limited to
904the \fBshort_display\fR limit.
460b9539 905.TP
906.B @part{\fICONTEXT\fB}{\fIPART\fB}{\fITRACK\fB}@
907Expands to track name part \fIPART\fR using context \fICONTEXT\fR for
908\fITRACK\fR. In this usage the context may not be omitted.
61507e3c
RK
909.IP
910The special context \fBshort\fR is equivalent to \fBdisplay\fR but limited to
911the \fBshort_display\fR limit.
460b9539 912.TP
913.B @paused@
914Expands to \fBtrue\fR if the current track is paused, else \fBfalse\fR.
915.TP
916.B @playing{\fITEMPLATE\fB}@
917Expands \fITEMPLATE\fR using the playing track as the current track.
918.TP
919.B @pref{\fITRACK\fB}{\fIKEY\fB}@
920Expand to the track preference, or the empty string if it is not set.
921.TP
922.B @prefname@
923Expands to the name of the current preference, in the template
924argument of \fB@prefs@\fR.
925.TP
926.B @prefs{\fIFILE\fB}{\fITEMPLATE\fB}@
927Expands \fITEMPLATE\fR repeatedly, for each preference of track
928\fIFILE\fR.
929Use \fB@prefname@\fR and \fB@prefvalue@\fR to get the name and value.
930.TP
931.B @prefvalue@
932Expands to the value of the current preference, in the template
933argument of \fB@prefs@\fR.
934.TP
935.B @queue{\fITEMPLATE\fB}@
936Expands \fITEMPLATE\fR repeatedly using the each track on the queue in turn as
937the current track. The track at the head of the queue comes first.
938.TP
939.B @random-enabled@
940Expands to \fBtrue\fR if random play is currently enabled, otherwise to
941\fBfalse\fR.
942.TP
943.B @recent{\fITEMPLATE\fB}@
944Expands \fITEMPLATE\fR repeatedly using the each recently played track in turn
945as the current track. The most recently played track comes first.
946.TP
947.B @resolve{\fITRACK\fB}@
948Resolve aliases for \fITRACK\fR and expands to the result.
949.TP
950.B @search{\fIPART\fB}\fR[\fB{\fICONTEXT\fB}\fR]\fB{\fITEMPLATE\fB}@
951Expands \fITEMPLATE\fR once for each group of search results that have
952a common value of track part \fIPART\fR.
953The groups are sorted by the value of the part.
954.IP
955.B @part@
956and
957.B @file@
958within the template will apply to one of the tracks in the group.
959.IP
960If \fICONTEXT\fR is specified it should be either \fBsort\fR or \fBdisplay\fR,
961and determines the context for \fIPART\fR. The default is \fBsort\fR. Usually
962you want \fBdisplay\fR for everything except the title and \fBsort\fR for the
963title. If you use \fBsort\fR for artist and album then you are likely to get
964strange effects.
965.TP
966.B @server-version@
967Expands to the server's version string.
968.TP
969.B @shell{\fICOMMAND\fB}@
970Expands to the output of \fICOMMAND\fR executed via the shell. \fBsh\fR is
971searched for using \fBPATH\fR. If the command fails then this is logged but
972otherwise ignored.
973.TP
974.B @state@
975In \fB@queue@\fR and \fB@recent@\fR, expands to the state of the current
976track. Otherwise the empty string. Known states are:
977.RS
978.TP 12
979.B failed
980The player terminated with nonzero status, but not because the track was
981scratched.
982.TP
983.B isscratch
984A scratch, in the queue.
985.TP
986.B no_player
987No player could be found.
988.TP
989.B ok
990Played successfully.
991.TP
992.B random
993A randomly chosen track, in the queue.
994.TP
995.B scratched
996This track was scratched.
997.TP
998.B unplayed
999An explicitly queued track, in the queue.
1000.RE
1001.IP
1002Some additional states only apply to playing tracks, so will never be seen in
1003the queue or recently-played list:
1004.RS
1005.TP 12
1006.B paused
1007The track has been paused.
1008.TP
1009.B quitting
1010Interrupted because the server is shutting down.
1011.TP
1012.B started
1013This track is currently playing.
1014.RE
1015.TP
1016.B @stats@
1017Expands to the server statistics.
1018.TP
1019.B @thisurl@
1020Expands to the URL of the current page. Typically used in
1021.B back
1022arguments. If there is a
1023.B nonce
1024argument then it is changed to a fresh value.
1025.TP
1026.B @track@
1027The current track.
1028.TP
1029.B @trackstate{\fIPATH\fB}@
1030Expands to the current track state: \fBplaying\fR if the track is actually
1031playing now, \fBqueued\fR if it is queued or the empty string otherwise.
1032.TP
1033.B @transform{\fIPATH\fB}{\fITYPE\fB}{\fICONTEXT\fB}@
1034Transform a path according to \fBtransform\fR (see above).
1035\fIPATH\fR should be a raw filename (of a track or directory).
1036\fITYPE\fR should be the transform type (e.g. \fItrack\fR or \fIdir\fR).
1037\fICONTEXT\fR should be the context, and can be omitted (the default
1038is \fBdisplay\fR).
1039.TP
1040.B @url@
1041Expands to the canonical URL as defined in \fIpkgconfdir/config\fR.
1042.TP
1043.B @urlquote{\fISTRING\fB}@
1044URL-quote \fISTRING\fR.
1045.TP
1046.B @version@
1047Expands to \fBdisorder.cgi\fR's version string.
1048.TP
1049.B @volume:\fISPEAKER\fB@
40c30921 1050The volume on the left or right speaker. \fISPEAKER\fR must be \fBleft\fR or
460b9539 1051\fBright\fR.
1052.TP
1053.B @when@
1054When the current track was played (or when it is expected to be played, if it
1055has not been played yet)
1056.TP
1057.B @who@
1058Who submitted the current track.
1059.SH "WEB OPTIONS"
1060This is a file called \fIoptions\fR, searched for in the same manner
1061as templates. It includes numerous options for the control of the web
1062interface. The general syntax is the same as the main configuration
1063file, except that it should be encoded using UTF-8 (though this might
1064change to the current locale's character encoding; stick to ASCII to
1065be safe).
1066.PP
1067The shipped \fIoptions\fR file includes four standard options files.
1068In order, they are:
1069.TP
1070.I options.labels
1071The default labels file. You wouldn't normally edit this directly - instead
1072supply your own commands in \fIoptions.user\fR. Have a look at the shipped
1073version of the file for documentation of labels used by the standard templates.
1074.TP
1075.I options.user
1076A user options file. Here you should put any overrides for the default
1077labels and any extra labels required by your modified templates.
1078.PP
1079Valid directives are:
1080.TP
1081.B columns \fINAME\fR \fIHEADING\fR...
1082Defines the columns used in \fB@playing@\fR and \fB@recent@\fB. \fINAME\fR
1083must be either \fBplaying\fR, \fBrecent\fR or \fBsearch\fR.
1084\fIHEADING\fR... is a list of
1085heading names. If a column is defined more than once then the last definitions
1086is used.
1087.IP
1088The heading names \fBbutton\fR, \fBlength\fR, \fBwhen\fR and \fBwho\fR
1089are built in.
1090.TP
1091.B include \fIPATH\fR
1092Includes another file. If \fIPATH\fR starts with a \fB/\fR then it is
1093taken as is, otherwise it is searched for in the template path.
1094.TP
1095.B label \fINAME\fR \fIVALUE\fR
1096Define a label. If a label is defined more than once then the last definition
1097is used.
1098.SS Labels
1099Some labels are defined inside \fBdisorder.cgi\fR and others by the
1100default templates. You can define your own labels and use them inside
1101a template.
1102.PP
1103When an undefined label is expanded, if it has a dot in its name then
1104the part after the final dot is used as its value. Otherwise the
1105whole name is used as the value.
1106.PP
1107Labels are no longer documented here, see the shipped \fIoptions.labels\fR file
1108instead.
1109.SH "REGEXP SUBSTITUTION RULES"
1110Regexps are PCRE regexps, as defined in \fBpcrepattern\fR(3). The
1111only option used is \fBPCRE_UTF8\fR. Remember that the configuration
1112file syntax means you have to escape backslashes and quotes inside
1113quoted strings.
1114.PP
1115In a \fISUBST\fR string the following sequences are interpreted
1116specially:
1117.TP
1118.B $1 \fR... \fB$9
1119These expand to the first to ninth bracketed subexpression.
1120.TP
1121.B $&
1122This expands to the matched part of the subject string.
1123.TP
1124.B $$
1125This expands to a single \fB$\fR symbol.
1126.PP
1127All other pairs starting with \fB$\fR are undefined (and might be used
1128for something else in the future, so don't rely on the current
1129behaviour.)
1130.PP
1131If \fBi\fR is present in \fIREFLAGS\fR then the match is case-independent. If
1132\fBg\fR is present then all matches are replaced, otherwise only the first
1133match is replaced.
1134.SH "ACTIONS"
1135What the web interface actually does is terminated by the \fBaction\fR CGI
1136argument. The values listed below are supported.
1137.PP
1138Except as specified, all actions redirect back to the \fBplaying.html\fR
1139template unless the \fBback\fR argument is present, in which case the URL it
1140gives is used instead.
1141.PP
1142Redirection to \fBplaying.html\fR preserves \fBmgmt=true\fR if it is present.
1143.TP 8
1144.B "move"
1145Move track \fBid\fR by offset \fBdelta\fR.
1146.TP
1147.B "play"
1148Play track \fBfile\fR, or if that is missing then play all the tracks in
1149\fBdirectory\fR.
1150.TP
1151.B "playing"
1152Don't change any state, but instead compute a suitable refresh time and include
1153that in an HTTP header. Expands the \fBplaying.html\fR template rather than
1154redirecting.
1155.IP
1156This is the default if \fBaction\fR is missing.
1157.TP
1158.B "random-disable"
1159Disables random play.
1160.TP
1161.B "random-enable"
1162Enables random play.
1163.TP
1164.B "disable"
1165Disables play completely.
1166.TP
1167.B "enable"
1168Enables play.
1169.TP
1170.B "pause"
1171Pauses the current track.
1172.TP
1173.B "remove"
1174Remove track \fBid\fR.
1175.TP
1176.B "resume"
1177Resumes play after a pause.
1178.TP
1179.B "scratch"
1180Scratch the playing track. If \fBid\fR is present it must match the playing
1181track.
1182.TP
1183.B "volume"
1184Change the volume by \fBdelta\fR, or if that is missing then set it to the
1185values of \fBleft\fR and \fBright\fR. Expands to the \fBvolume.html\fR template
1186rather than redirecting.
1187.TP
1188.B "prefs"
1189Adjust preferences from the \fBprefs.html\fR template (which it then expands
1190rather than redirecting).
1191.IP
1192If
1193.B parts
1194is set then the cooked interface is assumed. The value of
1195.B parts
1196is used to determine which trackname preferences are set. By default the
1197.B display
1198context is adjusted but this can be overridden with the
1199.B context
1200argument. Also the
1201.B random
1202argument is checked; if it is set then random play is enabled for that track,
1203otherwise it is disabled.
1204.IP
1205Otherwise if the
1206.B name
1207and
1208.B value
1209arguments are set then they are used to set a single preference.
1210.IP
1211Otherwise if just the
1212.B name
1213argument is set then that preference is deleted.
1214.IP
1215It is recommended that links to the \fBprefs\fR action use \fB@resolve@\fR to
1216enure that the real track name is always used. Otherwise if the preferences
1217page is used to adjust a trackname_ preference, the alias may change, leading
1218to the URL going stale.
1219.TP
1220.B "error"
1221This action is generated automatically when an error occurs connecting to the
1222server. The \fBerror\fR label is set to an indication of what the error is.
1223.SH "TRACK NAME PARTS"
1224The traditional track name parts are \fBartist\fR, \fBalbum\fR and \fBtitle\fR,
1225with the obvious intended meaning. These are controlled by configuration and
1226by \fBtrackname_\fR preferences.
1227.PP
1228In addition there are two built-in parts, \fBpath\fR which is the whole path
1229name and \fBext\fR which is the filename extension, including the initial dot
1230(or the empty string if there is not extension).
1231.SH "SEE ALSO"
77cfc7a2 1232\fBdisorder\fR(1), \fBsox\fR(1), \fBdisorderd\fR(8), \fBdisorder-dump\fR(8),
460b9539 1233\fBpcrepattern\fR(3)
1234.\" Local Variables:
1235.\" mode:nroff
1236.\" fill-column:79
1237.\" End: