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