chiark / gitweb /
disorder-choose rejects tracks in queue/recent list
[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
405fea4e 587.B sample_format \fIBITS\fB/\fIRATE\fB/\fICHANNELS
c0c23a60
RK
588Describes the sample format expected by the \fBspeaker_command\fR (below).
589The components of the format specification are as follows:
405fea4e 590.RS
591.TP 10
592.I BITS
c0c23a60
RK
593The number of bits per sample.
594Optionally, may be suffixed by \fBb\fR or \fBl\fR for big-endian and
595little-endian words.
596If neither is used the native byte order is assumed.
405fea4e 597.TP
598.I RATE
599The number of samples per second.
600.TP
601.I CHANNELS
602The number of channels.
603.PP
604The default is
605.BR 16/44100/2 .
937be4c0
RK
606.PP
607With the
608.B network
609backend the sample format is forced to
e99d42b1 610.B 16b/44100/2
937be4c0
RK
611and with the
612.B coreaudio
613backend it is forced to
614.BR 16/44100/2 ,
615in both cases regardless of what is specified in the configuration file.
405fea4e 616.RE
617.TP
460b9539 618.B signal \fINAME\fR
619Defines the signal to be sent to track player process groups when tracks are
c0c23a60
RK
620scratched.
621The default is \fBSIGKILL\fR.
460b9539 622.IP
623Signals are specified by their full C name, i.e. \fBSIGINT\fR and not \fBINT\fR
624or \fBInterrupted\fR or whatever.
625.TP
5330d674 626.B sox_generation \fB0\fR|\fB1
0d350ff0
RK
627Determines whether calls to \fBsox\fR(1) should use \fB\-b\fR, \fB\-x\fR, etc (if
628the generation is 0) or \fB\-\fIbits\fR, \fB\-L\fR etc (if it is 1).
c0c23a60
RK
629See the documentation for your installed copy of \fBsox\fR to determine
630which you need.
25ca855b 631The default is 0.
5330d674 632.TP
bd8895a8 633.B speaker_backend \fINAME
634This is an alias for \fBapi\fR; see above.
635.TP
405fea4e 636.B speaker_command \fICOMMAND
637Causes the speaker subprocess to pipe audio data into shell command
c0c23a60
RK
638\fICOMMAND\fR, rather than writing to a local sound card.
639The sample format is determine by
405fea4e 640.B sample_format
641above.
77cfc7a2 642.IP
643Note that if the sample format is wrong then
644.BR sox (1)
c0c23a60
RK
645is invoked to translate it.
646If
77cfc7a2 647.B sox
648is not installed then this will not work.
405fea4e 649.TP
460b9539 650.B scratch \fIPATH\fR
c0c23a60
RK
651Specifies a scratch.
652When a track is scratched, a scratch track is played at random.
460b9539 653Scratches are played using the same logic as other tracks.
654.IP
655At least for the time being, path names of scratches must be encoded using
656UTF-8 (which means that ASCII will do).
40c30921
RK
657.IP
658If \fBscratch\fR is used without arguments then the list of scratches is
659cleared.
460b9539 660.TP
661.B stopword \fIWORD\fR ...
662Specifies one or more stopwords that should not take part in searches
663over track names.
40c30921
RK
664.IP
665If \fBstopword\fR is used without arguments then the list of stopwords is
666cleared.
86be0c30 667.IP
668There is a default set of stopwords built in, but this option can be used to
669augment or replace that list.
62dc3748
RK
670.TP
671.B tracklength \fIPATTERN\fR \fIMODULE\fR
672Specifies the module used to calculate the length of files matching
c0c23a60
RK
673\fIPATTERN\fR.
674\fIMODULE\fR specifies which plugin module to use.
40c30921
RK
675.IP
676If \fBtracklength\fR is used without arguments then the list of modules is
677cleared.
eb5dc014
RK
678.TP
679.B user \fIUSER\fR
c0c23a60
RK
680Specifies the user to run as.
681Only makes sense if invoked as root (or the target user).
460b9539 682.SS "Client Configuration"
683.TP
ccf0aafa 684.B connect \fIHOST SERVICE\fR
460b9539 685Connect to the address specified by \fIHOST\fR and port specified by
ccf0aafa 686\fISERVICE\fR.
460b9539 687.SS "Web Interface Configuration"
688.TP
e70701e7 689.B mail_sender \fIADDRESS\fR
690The email address that appears in the From: field of any mail messages sent by
c0c23a60
RK
691the web interface.
692This must be set if you have online registration enabled.
e70701e7 693.TP
460b9539 694.B refresh \fISECONDS\fR
c0c23a60
RK
695Specifies the maximum refresh period in seconds.
696Default 15.
460b9539 697.TP
61507e3c
RK
698.B short_display \fICHARACTERS\fR
699Defines the maximum number of characters to include in a \fBshort\fR name
c0c23a60
RK
700part.
701Default 30.
61507e3c 702.TP
e70701e7 703.B smtp_server \fIHOSTNAME\fR
c0c23a60
RK
704The hostname (or address) of the SMTP server to use for sending mail.
705The default is 127.0.0.1.
e70701e7 706.TP
460b9539 707.B templates \fIPATH\fR ...
708Specifies the directory containing templates used by the web
c0c23a60
RK
709interface.
710If a template appears in more than one template directory
460b9539 711then the one in the earliest directory specified is chosen.
712.IP
713See below for further details.
40c30921
RK
714.IP
715If \fBtemplates\fR is used without arguments then the template path is cleared.
460b9539 716.TP
717.B transform \fITYPE\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
718Determines how names are sorted and displayed in track choice displays.
719.IP
720\fITYPE\fR is the type of transformation; usually \fBtrack\fR or
721\fBdir\fR but you can define your own.
722.IP
c0c23a60
RK
723\fICONTEXT\fR is a glob pattern matching the context.
724Standard contexts are \fBsort\fR (which determines how directory names
725are sorted) and \fBdisplay\fR (which determines how they are displayed).
726Again, you can define your own.
460b9539 727.IP
c0c23a60
RK
728All the \fBtransform\fR directives are considered in order.
729If the \fITYPE\fR, \fIREGEXP\fR and the \fICONTEXT\fR match
460b9539 730then a new track name is constructed from
c0c23a60
RK
731\fISUBST\fR according to the substitution rules below.
732If several match then each is executed in order.
460b9539 733.IP
734If you supply no \fBtransform\fR directives at all then a default set will be
c0c23a60
RK
735supplied automatically.
736But if you supply even one then you must supply all of them.
737The defaults are:
25ca855b
RK
738.PP
739.nf
740transform track "^.*/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
741transform track "^.*/([^/]+)\\.[a-zA-Z0-9]+$" $1 sort
742transform dir "^.*/([^/]+)$" $1 *
743transform dir "^(the) ([^/]*)" "$2 $1" sort i
744transform dir "[[:punct:]]" "" sort g
745.fi
460b9539 746.TP
747.B url \fIURL\fR
c0c23a60
RK
748Specifies the URL of the web interface.
749This URL will be used in generated web pages.
750The default is inferred at runtime, so this option no
b64c2805 751longer needs to be specified.
460b9539 752.IP
753This must be the full URL, e.g. \fBhttp://myhost/cgi-bin/jukebox\fR and not
754\fB/cgi-bin/jukebox\fR.
755.SS "Authentication Configuration"
eb5dc014
RK
756These options would normally be used in \fI~\fRUSER\fI/.disorder/passwd\fR or
757\fIpkgconfdir/config.\fRUSER.
460b9539 758.TP
460b9539 759.B password \fIPASSWORD\fR
760Specify password.
761.TP
460b9539 762.B username \fIUSERNAME\fR
c0c23a60
RK
763Specify username.
764The default is taken from the environment variable \fBLOGNAME\fR.
460b9539 765.SH "GLOBAL PREFERENCES"
0d350ff0 766These are the values set with \fBset\-global\fR.
460b9539 767.TP
0d350ff0 768.B required\-tags
460b9539 769If this is set an nonempty then randomly played tracks will always have at
770least one of the listed tags.
460b9539 771.TP
0d350ff0 772.B prohibited\-tags
460b9539 773If this is set an nonempty then randomly played tracks will never have any of
774the listed tags.
775.TP
776.B playing
c0c23a60
RK
777If unset or \fByes\fR then play is enabled.
778Otherwise it is disabled.
779Use \fBdisable\fR rather than setting it directly.
460b9539 780.TP
0d350ff0 781.B random\-play
c0c23a60
RK
782If unset or \fByes\fR then random play is enabled.
783Otherwise it is disabled.
460b9539 784Use \fBdisable\fR rather than setting it directly.
f9635e06
RK
785.PP
786Global preferences starting '_' are read-only (in the sense that you cannot
c0c23a60
RK
787modify them; the server may modify them as part of its normal operation).
788They are:
f9635e06
RK
789.TP
790.B _dbversion
c0c23a60
RK
791The database version string.
792This is used by DisOrder to detect when it must
f9635e06 793modify the database after an upgrade.
460b9539 794.SH "LIBAO DRIVER"
795.SS "Raw Protocol Players"
796Raw protocol players are expected to use the \fBdisorder\fR libao driver.
797Programs that use libao generally have command line options to select the
798driver and pass options to it.
799.SS "Driver Options"
800The known driver options are:
801.TP
802.B fd
c0c23a60
RK
803The file descriptor to write to.
804If this is not specified then the driver looks like the environment
805variable \fBDISORDER_RAW_FD\fR.
806If that is not set then the default is 1 (i.e. standard output).
460b9539 807.TP
808.B fragile
809If this is set to a nonzero value then the driver will call \fB_exit\fR(2) if a
c0c23a60
RK
810write to the output file descriptor fails.
811This is a workaround for buggy players such as \fBogg123\fR that ignore
812write errors.
460b9539 813.SH "WEB TEMPLATES"
814When \fBdisorder.cgi\fR wants to generate a page for an action it searches the
c0c23a60
RK
815directories specified with \fBtemplates\fR for a matching file.
816It is suggested that you leave the distributed templates unchanged and put
460b9539 817any customisations in an earlier entry in the template path.
818.PP
819The supplied templates are:
820.TP
821.B about.html
822Display information about DisOrder.
823.TP
824.B choose.html
c0c23a60
RK
825Navigates through the track database to choose a track to play.
826The \fBdir\fR argument gives the directory to look in; if it is missing
460b9539 827then the root directory is used.
828.TP
829.B choosealpha.html
830Provides a front end to \fBchoose.html\fR which allows subsets of the top level
831directories to be selected by initial letter.
832.TP
d5b6ffd7
RK
833.B new.html
834Lists newly added tracks.
835.TP
460b9539 836.B playing.html
837The "front page", which usually shows the currently playing tracks and
838the queue.
839Gets an HTTP \fBRefresh\fR header.
840.IP
841If the \fBmgmt\fR CGI argument is set to \fBtrue\fR then we include extra
c0c23a60
RK
842buttons for moving tracks up and down in the queue.
843There is some logic in \fBdisorder.cgi\fR to ensure that \fBmgmt=true\fR
844is preserved across refreshes and redirects back into itself, but
845URLs embedded in web pages must include it explicitly.
460b9539 846.TP
847.B prefs.html
c0c23a60
RK
848Views preferences.
849If the \fBfile\fR, \fBname\fR and \fBvalue\fR arguments are
460b9539 850all set then that preference is modified; if \fBfile\fR and \fBname\fR are set
851but not \fBvalue\fR then the preference is deleted.
852.TP
853.B recent.html
854Lists recently played tracks.
855.TP
856.B search.html
857Presents search results.
858.TP
859.B volume.html
860Primitive volume control.
861.PP
862Additionally, other standard files are included by these:
863.TP
864.B credits.html
865Included at the end of the main content \fB<DIV>\fR element.
866.TP
d5b6ffd7 867.B topbar.html
e12da4d9 868Included at the start of the \fB<BODY>\fR element.
869.TP
870.B topbarend.html
871Included at the end of the \fB<BODY>\fR element.
460b9539 872.TP
873.B stdhead.html
874Included in the \fB<HEAD>\fR element.
875.TP
876.B stylesheet.html
c0c23a60
RK
877Contains the default DisOrder stylesheet.
878You can override this by editing the CSS or by replacing it all with
879a \fB<LINK>\fR to an external stylesheet.
460b9539 880.PP
881Templates are ASCII files containing HTML documents, with an expansion
882syntax to enable data supplied by the implementation to be inserted.
883.PP
884If you want to use characters outside the ASCII range, use either the
885appropriate HTML entity, e.g. \fB&eacute;\fR, or an SGML numeric
c0c23a60
RK
886character reference, e.g. \fB&#253;\fR.
887Use \fB&#64;\fR to insert a literal \fB@\fR without falling foul of
888the expansion syntax.
460b9539 889.SS "Expansion Syntax"
890Expansions are surrounded by at ("@") symbols take the form of a keyword
c0c23a60
RK
891followed by zero or more arguments.
892Arguments may either be quoted by curly brackets ("{" and "}") or separated
893by colons (":").
894Both kinds may be mixed in a single expansion, though doing so seems
895likely to cause confusion.
896The descriptions below contain suggested forms for each expansion.
460b9539 897.PP
898Leading and trailing whitespace in unquoted arguments is ignored, as is
899whitespace (including newlines) following a close bracket ("}").
900.PP
901Arguments are recursively expanded before being interpreted, except for
c0c23a60
RK
902\fITEMPLATE\fR arguments.
903These are expanded (possibly more than once) to produce the final expansion.
460b9539 904(More than once means the same argument being expanded more than once
905for different tracks or whatever, not the result of the first
906expansion itself being re-expanded.)
907.PP
908Strings constructed by expansions (i.e. not literally copied from the template
909text) are SGML-quoted: any character which does not stand for itself in #PCDATA
910or a quoted attribute value is replaced by the appropriate numeric character
911reference.
912.PP
913The exception to this is that such strings are \fInot\fR quoted when they are
914generated in the expansion of a parameter.
915.PP
916In the descriptions below, the current track means the one set by
917\fB@playing@\fR, \fB@recent@\fR or \fB@queue@\fR, not the one that is playing.
918If none of these expansions are in force then there is no current track.
919\fIBOOL\fR should always be either \fBtrue\fR or \fBfalse\fR.
920.SS "Expansions"
921The following expansion keywords are defined:
922.TP
923.B @#{\fICOMMENT\fB}@
924Ignored.
925.TP
926.B @action@
c0c23a60
RK
927The current action.
928This reports
460b9539 929.B manage
930if the action is really
931.B playing
932but
933.B mgmt=true
934was set.
935.TP
936.B @and{\fIBOOL\fB}{\fIBOOL\fB}\fR...\fB@
937If there are no arguments, or all the arguments are \fBtrue\fB, then expands to
938\fBtrue\fR, otherwise to \fBfalse\fR.
939.TP
940.B @arg:\fINAME\fB@
25ca855b 941Expands to the value of CGI argument \fINAME\fR.
460b9539 942.TP
943.B @basename@
944The basename of the current directory component, in \fB@navigate@\fR.
945.TP
946.B @basename{\fIPATH\fB}@
947The base name part of \fIPATH\fR.
948.TP
949.B @choose{\fIWHAT\fB}{\fITEMPLATE\fB}@
950Expands \fITEMPLATE\fR repeatedly for each file or directory under
951\fB@arg:directory@\fR.
952\fIWHAT\fR should be either \fBfile\fR or \fBdirectory\fR.
953Use \fB@file@\fR to get the display name or filename of the file or
954directory.
955Usually used in \fBchoose.html\fR.
956.TP
957.B @dirname@
958The directory of the current directory component, in \fB@navigate@\fR.
959.TP
960.B @dirname{\fIPATH\fB}@
961The directory part of \fIPATH\fR.
962.TP
963.B @enabled@
964Expands to \fBtrue\fR if play is currently enabled, otherwise to \fBfalse\fR.
965.TP
966.B @eq{\fIA\fB}{\fIB\fB}
967Expands to \fBtrue\fR if \fIA\fR and \fIB\fR are identical, otherwise to
968\fBfalse\fR.
969.TP
970.B @file@
971Expands to the filename of the current file or directory, inside the template
972argument to \fBchoose\fR.
973.TP
974.B @files{\fITEMPLATE\fB}
40c30921 975Expands \fITEMPLATE\fR once for each file indicated by the \fBdirectory\fR CGI
460b9539 976arg if it is present, or otherwise for the list of files counted by \fBfiles\fR
977with names \fB0_file\fR, \fB1_file\fR etc.
978.TP
979.B @fullname@
980The full path of the current directory component, in \fB@navigate@\fR.
981.TP
982.B @id@
983The ID of the current track.
984.TP
985.B @if{\fIBOOL\fB}{\fITRUEPART\fB}{\fIFALSEPART\fB}@
986If \fIBOOL\fR expands to \fBtrue\fR then expands to \fITRUEPART\fR, otherwise
987to \fIFALSEPART\fR (which may be omitted).
988.TP
8f9616f1
RK
989.B @image:\fINAME\fB@
990Expands to the (possibly relative) URL for image \fINAME\fR.
991.IP
992If there is a label \fBimages.\fINAME\fR then that will be the image base name.
993Otherwise the image base name is \fINAME\fB.png\fR or just \fINAME\fR if it
c0c23a60
RK
994alraedy has an extension.
995Thus labels may be defined to give images role names.
8f9616f1 996.IP
c0c23a60
RK
997If there is a label \fBurl.static\fR then that is the base URL for images.
998If it is not defined then \fB/disorder\fR is used as a default.
8f9616f1
RK
999.TP
1000.B @include:\fIPATH\fB@
c0c23a60
RK
1001Include the named file as if it were a template file.
1002If \fIPATH\fR starts with a \fB/\fR then it is used as-is;
1003otherwise, ".html" is appended and the template path is searched.
460b9539 1004.TP
1005.B @index@
1006Expands to the index of the current file in \fB@queue@\fR, \fB@recent@\fR or
1007\fB@files@\fR.
1008.TP
1009.B @isdirectories@
1010Expands to \fBtrue\fR if there are any directories in \fB@arg:directory@\fR,
1011otherwise to \fBfalse\fR.
1012.TP
1013.B @isfiles@
1014Expands to \fBtrue\fR if there are any files in \fB@arg:directory@\fR,
1015otherwise to \fBfalse\fR.
1016.TP
1017.B @isfirst@
1018Expands to \fBtrue\fR if this is the first repetition of a \fITEMPLATE\fR
1019argument in a loop (\fB@queue\fR or similar), otherwise to \fBfalse\fR.
1020.TP
1021.B @islast@
1022Expands to \fBtrue\fR if this is the last repetition of a \fITEMPLATE\fR in a
1023loop, otherwise to \fBfalse\fR.
1024.TP
d5b6ffd7
RK
1025.B @isnew@
1026Expands to \fBtrue\fR if the newly added tracks list has any tracks in it,
1027otherwise to \fBfalse\fR.
1028.TP
460b9539 1029.B @isplaying@
1030Expands to \fBtrue\fR if a track is playing, otherwise to \fBfalse\fR.
1031.TP
1032.B @isqueue@
1033Expands to \fBtrue\fR if there are any tracks in the queue, otherwise to
1034\fBfalse\fR.
1035.TP
1036.B @isrecent@
1037Expands to \fBtrue\fR if the recently played list has any tracks in it,
1038otherwise to \fBfalse\fR.
1039.TP
1040.B @label:\fINAME\fR\fB@
c0c23a60
RK
1041Expands to the value of label \fINAME\fR.
1042See the shipped \fIoptions.labels\fR file for full documentation of the
1043labels used by the standard templates.
460b9539 1044.TP
1045.B @length@
1046Expands to the length of the current track.
1047.TP
938d8157 1048.B @movable@
1049Expands to \fBtrue\fR if the current track is movable, otherwise to
1050\fBfalse\fR.
1051.TP
460b9539 1052.B @navigate{\fIDIRECTORY\fB}{\fITEMPLATE\fB}
1053Expands \fITEMPLATE\fR for each component of \fIDIRECTORY\fR in turn.
1054Use \fB@dirname\fR and \fB@basename@\fR to get the components of the path to
1055each component.
1056Usually used in \fBchoose.html\fR.
1057.TP
1058.B @ne{\fIA\fB}{\fIB\fB}
1059Expands to \fBtrue\fR if \fIA\fR and \fIB\fR differ, otherwise to \fBfalse\fR.
1060.TP
d5b6ffd7
RK
1061.B @new{\fITEMPLATE\fB}
1062Expands \fITEMPLATE\fR for each track in the newly added tracks list, starting
c0c23a60
RK
1063with the most recent.
1064Used in \fBnew.html\fR.
d5b6ffd7 1065.TP
460b9539 1066.B @nfiles@
1067Expands to the number of files from \fB@files\fR (above).
1068.TP
1069.B @nonce@
1070Expands to a string including the time and process ID, intended to be
1071unique across invocations.
1072.TP
1073.B @not{\fIBOOL\fB}@
1074Expands to \fBfalse\fR if \fIBOOL\fR is \fBtrue\fR, otherwise to
1075\fBfalse\fR.
1076.TP
1077.B @or{\fIBOOL\fB}{\fIBOOL\fB}\fR...\fB@
1078If at least one argument is \fBtrue\fB, then expands to \fBtrue\fR, otherwise
1079to \fBfalse\fR.
1080.TP
1081.B @parity@
1082Expands to \fBeven\fR or \fBodd\fR depending on whether the current track is at
1083an even or odd position in \fB@queue@\fR, \fB@recent@\fR or \fB@files@\fR.
1084.TP
1085.B @part{\fICONTEXT\fB}{\fIPART\fB}@
1086Expands to track name part \fIPART\fR using context \fICONTEXT\fR for the
c0c23a60
RK
1087current track.
1088The context may be omitted and defaults to \fBdisplay\fR.
61507e3c
RK
1089.IP
1090The special context \fBshort\fR is equivalent to \fBdisplay\fR but limited to
1091the \fBshort_display\fR limit.
460b9539 1092.TP
1093.B @part{\fICONTEXT\fB}{\fIPART\fB}{\fITRACK\fB}@
1094Expands to track name part \fIPART\fR using context \fICONTEXT\fR for
c0c23a60
RK
1095\fITRACK\fR.
1096In this usage the context may not be omitted.
61507e3c
RK
1097.IP
1098The special context \fBshort\fR is equivalent to \fBdisplay\fR but limited to
1099the \fBshort_display\fR limit.
460b9539 1100.TP
1101.B @paused@
1102Expands to \fBtrue\fR if the current track is paused, else \fBfalse\fR.
1103.TP
1104.B @playing{\fITEMPLATE\fB}@
1105Expands \fITEMPLATE\fR using the playing track as the current track.
1106.TP
1107.B @pref{\fITRACK\fB}{\fIKEY\fB}@
1108Expand to the track preference, or the empty string if it is not set.
1109.TP
1110.B @prefname@
1111Expands to the name of the current preference, in the template
1112argument of \fB@prefs@\fR.
1113.TP
1114.B @prefs{\fIFILE\fB}{\fITEMPLATE\fB}@
1115Expands \fITEMPLATE\fR repeatedly, for each preference of track
1116\fIFILE\fR.
1117Use \fB@prefname@\fR and \fB@prefvalue@\fR to get the name and value.
1118.TP
1119.B @prefvalue@
1120Expands to the value of the current preference, in the template
1121argument of \fB@prefs@\fR.
1122.TP
1123.B @queue{\fITEMPLATE\fB}@
1124Expands \fITEMPLATE\fR repeatedly using the each track on the queue in turn as
c0c23a60
RK
1125the current track.
1126The track at the head of the queue comes first.
460b9539 1127.TP
0d350ff0 1128.B @random\-enabled@
460b9539 1129Expands to \fBtrue\fR if random play is currently enabled, otherwise to
1130\fBfalse\fR.
1131.TP
1132.B @recent{\fITEMPLATE\fB}@
1133Expands \fITEMPLATE\fR repeatedly using the each recently played track in turn
c0c23a60
RK
1134as the current track.
1135The most recently played track comes first.
460b9539 1136.TP
938d8157 1137.B @removable@
1138Expands to \fBtrue\fR if the current track is removable, otherwise to
1139\fBfalse\fR.
1140.TP
460b9539 1141.B @resolve{\fITRACK\fB}@
1142Resolve aliases for \fITRACK\fR and expands to the result.
1143.TP
938d8157 1144.B @right{\fIRIGHT\fB}@
1145Exapnds to \fBtrue\fR if the user has right \fIRIGHT\fR, otherwise to
1146\fBfalse\fR.
1147.TP
1148.B @right{\fIRIGHT\fB}{\fITRUEPART\fB}{\fIFALSEPART\fB}@
1149Expands to \fITRUEPART\fR if the user right \fIRIGHT\fR, otherwise to
1150\fIFALSEPART\fR (which may be omitted).
1151.TP
1152.B @scratchable@
1153Expands to \fBtrue\fR if the currently playing track is scratchable, otherwise
1154to \fBfalse\fR.
1155.TP
460b9539 1156.B @search{\fIPART\fB}\fR[\fB{\fICONTEXT\fB}\fR]\fB{\fITEMPLATE\fB}@
1157Expands \fITEMPLATE\fR once for each group of search results that have
1158a common value of track part \fIPART\fR.
1159The groups are sorted by the value of the part.
1160.IP
1161.B @part@
1162and
1163.B @file@
1164within the template will apply to one of the tracks in the group.
1165.IP
1166If \fICONTEXT\fR is specified it should be either \fBsort\fR or \fBdisplay\fR,
c0c23a60
RK
1167and determines the context for \fIPART\fR.
1168The default is \fBsort\fR.
1169Usually you want \fBdisplay\fR for everything except the title and
1170\fBsort\fR for the title.
1171If you use \fBsort\fR for artist and album then you are likely to get
460b9539 1172strange effects.
1173.TP
0d350ff0 1174.B @server\-version@
460b9539 1175Expands to the server's version string.
1176.TP
1177.B @shell{\fICOMMAND\fB}@
c0c23a60
RK
1178Expands to the output of \fICOMMAND\fR executed via the shell.
1179\fBsh\fR is searched for using \fBPATH\fR.
1180If the command fails then this is logged but otherwise ignored.
460b9539 1181.TP
1182.B @state@
1183In \fB@queue@\fR and \fB@recent@\fR, expands to the state of the current
c0c23a60
RK
1184track.
1185Otherwise the empty string.
1186Known states are:
460b9539 1187.RS
1188.TP 12
1189.B failed
1190The player terminated with nonzero status, but not because the track was
1191scratched.
1192.TP
1193.B isscratch
1194A scratch, in the queue.
1195.TP
1196.B no_player
1197No player could be found.
1198.TP
1199.B ok
1200Played successfully.
1201.TP
1202.B random
1203A randomly chosen track, in the queue.
1204.TP
1205.B scratched
1206This track was scratched.
1207.TP
1208.B unplayed
1209An explicitly queued track, in the queue.
1210.RE
1211.IP
1212Some additional states only apply to playing tracks, so will never be seen in
1213the queue or recently-played list:
1214.RS
1215.TP 12
1216.B paused
1217The track has been paused.
1218.TP
1219.B quitting
1220Interrupted because the server is shutting down.
1221.TP
1222.B started
1223This track is currently playing.
1224.RE
1225.TP
1226.B @stats@
1227Expands to the server statistics.
1228.TP
1229.B @thisurl@
c0c23a60
RK
1230Expands to the URL of the current page.
1231Typically used in
460b9539 1232.B back
c0c23a60
RK
1233arguments.
1234If there is a
460b9539 1235.B nonce
1236argument then it is changed to a fresh value.
1237.TP
1238.B @track@
1239The current track.
1240.TP
1241.B @trackstate{\fIPATH\fB}@
1242Expands to the current track state: \fBplaying\fR if the track is actually
1243playing now, \fBqueued\fR if it is queued or the empty string otherwise.
1244.TP
1245.B @transform{\fIPATH\fB}{\fITYPE\fB}{\fICONTEXT\fB}@
1246Transform a path according to \fBtransform\fR (see above).
1247\fIPATH\fR should be a raw filename (of a track or directory).
1248\fITYPE\fR should be the transform type (e.g. \fItrack\fR or \fIdir\fR).
1249\fICONTEXT\fR should be the context, and can be omitted (the default
1250is \fBdisplay\fR).
1251.TP
1252.B @url@
1253Expands to the canonical URL as defined in \fIpkgconfdir/config\fR.
1254.TP
1255.B @urlquote{\fISTRING\fB}@
1256URL-quote \fISTRING\fR.
1257.TP
fdf98378 1258.B @user@
c0c23a60
RK
1259The current username.
1260This will be "guest" if nobody is logged in.
fdf98378 1261.TP
968f044a 1262.B @userinfo{\fIPROPERTY\fB}@
1263Look up a property of the logged-in user.
1264.TP
460b9539 1265.B @version@
1266Expands to \fBdisorder.cgi\fR's version string.
1267.TP
1268.B @volume:\fISPEAKER\fB@
c0c23a60
RK
1269The volume on the left or right speaker.
1270\fISPEAKER\fR must be \fBleft\fR or \fBright\fR.
460b9539 1271.TP
1272.B @when@
1273When the current track was played (or when it is expected to be played, if it
1274has not been played yet)
1275.TP
1276.B @who@
1277Who submitted the current track.
1278.SH "WEB OPTIONS"
1279This is a file called \fIoptions\fR, searched for in the same manner
c0c23a60
RK
1280as templates.
1281It includes numerous options for the control of the web interface.
1282The general syntax is the same as the main configuration
460b9539 1283file, except that it should be encoded using UTF-8 (though this might
1284change to the current locale's character encoding; stick to ASCII to
1285be safe).
1286.PP
1287The shipped \fIoptions\fR file includes four standard options files.
1288In order, they are:
1289.TP
1290.I options.labels
c0c23a60
RK
1291The default labels file.
1292You wouldn't normally edit this directly - instead supply your own commands
1293in \fIoptions.user\fR.
1294Have a look at the shipped version of the file for documentation of
1295labels used by the standard templates.
460b9539 1296.TP
1297.I options.user
c0c23a60
RK
1298A user options file.
1299Here you should put any overrides for the default labels and any
1300extra labels required by your modified templates.
460b9539 1301.PP
1302Valid directives are:
1303.TP
1304.B columns \fINAME\fR \fIHEADING\fR...
c0c23a60
RK
1305Defines the columns used in \fB@playing@\fR and \fB@recent@\fB.
1306\fINAME\fR must be either \fBplaying\fR, \fBrecent\fR or \fBsearch\fR.
1307\fIHEADING\fR... is a list of heading names.
1308If a column is defined more than once then the last definitions is used.
460b9539 1309.IP
1310The heading names \fBbutton\fR, \fBlength\fR, \fBwhen\fR and \fBwho\fR
1311are built in.
1312.TP
1313.B include \fIPATH\fR
c0c23a60
RK
1314Includes another file.
1315If \fIPATH\fR starts with a \fB/\fR then it is taken as is, otherwise
1316it is searched for in the template path.
460b9539 1317.TP
1318.B label \fINAME\fR \fIVALUE\fR
c0c23a60
RK
1319Define a label.
1320If a label is defined more than once then the last definition is used.
460b9539 1321.SS Labels
1322Some labels are defined inside \fBdisorder.cgi\fR and others by the
c0c23a60
RK
1323default templates.
1324You can define your own labels and use them inside a template.
460b9539 1325.PP
1326When an undefined label is expanded, if it has a dot in its name then
c0c23a60
RK
1327the part after the final dot is used as its value.
1328Otherwise the whole name is used as the value.
460b9539 1329.PP
1330Labels are no longer documented here, see the shipped \fIoptions.labels\fR file
1331instead.
1332.SH "REGEXP SUBSTITUTION RULES"
c0c23a60
RK
1333Regexps are PCRE regexps, as defined in \fBpcrepattern\fR(3).
1334The only option used is \fBPCRE_UTF8\fR.
1335Remember that the configuration file syntax means you have to
1336escape backslashes and quotes inside quoted strings.
460b9539 1337.PP
1338In a \fISUBST\fR string the following sequences are interpreted
1339specially:
1340.TP
1341.B $1 \fR... \fB$9
1342These expand to the first to ninth bracketed subexpression.
1343.TP
1344.B $&
1345This expands to the matched part of the subject string.
1346.TP
1347.B $$
1348This expands to a single \fB$\fR symbol.
1349.PP
1350All other pairs starting with \fB$\fR are undefined (and might be used
1351for something else in the future, so don't rely on the current
1352behaviour.)
1353.PP
c0c23a60
RK
1354If \fBi\fR is present in \fIREFLAGS\fR then the match is case-independent.
1355If \fBg\fR is present then all matches are replaced, otherwise only the first
460b9539 1356match is replaced.
1357.SH "ACTIONS"
1358What the web interface actually does is terminated by the \fBaction\fR CGI
c0c23a60
RK
1359argument.
1360The values listed below are supported.
460b9539 1361.PP
1362Except as specified, all actions redirect back to the \fBplaying.html\fR
1363template unless the \fBback\fR argument is present, in which case the URL it
1364gives is used instead.
1365.PP
1366Redirection to \fBplaying.html\fR preserves \fBmgmt=true\fR if it is present.
1367.TP 8
1368.B "move"
1369Move track \fBid\fR by offset \fBdelta\fR.
1370.TP
1371.B "play"
1372Play track \fBfile\fR, or if that is missing then play all the tracks in
1373\fBdirectory\fR.
1374.TP
1375.B "playing"
1376Don't change any state, but instead compute a suitable refresh time and include
c0c23a60
RK
1377that in an HTTP header.
1378Expands the \fBplaying.html\fR template rather than redirecting.
460b9539 1379.IP
1380This is the default if \fBaction\fR is missing.
1381.TP
0d350ff0 1382.B "random\-disable"
460b9539 1383Disables random play.
1384.TP
0d350ff0 1385.B "random\-enable"
460b9539 1386Enables random play.
1387.TP
1388.B "disable"
1389Disables play completely.
1390.TP
1391.B "enable"
1392Enables play.
1393.TP
1394.B "pause"
1395Pauses the current track.
1396.TP
1397.B "remove"
1398Remove track \fBid\fR.
1399.TP
1400.B "resume"
1401Resumes play after a pause.
1402.TP
1403.B "scratch"
c0c23a60
RK
1404Scratch the playing track.
1405If \fBid\fR is present it must match the playing track.
460b9539 1406.TP
1407.B "volume"
1408Change the volume by \fBdelta\fR, or if that is missing then set it to the
c0c23a60
RK
1409values of \fBleft\fR and \fBright\fR.
1410Expands to the \fBvolume.html\fR template rather than redirecting.
460b9539 1411.TP
1412.B "prefs"
1413Adjust preferences from the \fBprefs.html\fR template (which it then expands
1414rather than redirecting).
1415.IP
1416If
1417.B parts
c0c23a60
RK
1418is set then the cooked interface is assumed.
1419The value of
460b9539 1420.B parts
c0c23a60
RK
1421is used to determine which trackname preferences are set.
1422By default the
460b9539 1423.B display
1424context is adjusted but this can be overridden with the
1425.B context
c0c23a60
RK
1426argument.
1427Also the
460b9539 1428.B random
1429argument is checked; if it is set then random play is enabled for that track,
1430otherwise it is disabled.
1431.IP
1432Otherwise if the
1433.B name
1434and
1435.B value
1436arguments are set then they are used to set a single preference.
1437.IP
1438Otherwise if just the
1439.B name
1440argument is set then that preference is deleted.
1441.IP
1442It is recommended that links to the \fBprefs\fR action use \fB@resolve@\fR to
c0c23a60
RK
1443enure that the real track name is always used.
1444Otherwise if the preferences page is used to adjust a trackname_ preference,
1445the alias may change, leading to the URL going stale.
460b9539 1446.TP
1447.B "error"
1448This action is generated automatically when an error occurs connecting to the
c0c23a60
RK
1449server.
1450The \fBerror\fR label is set to an indication of what the error is.
460b9539 1451.SH "TRACK NAME PARTS"
1452The traditional track name parts are \fBartist\fR, \fBalbum\fR and \fBtitle\fR,
c0c23a60
RK
1453with the obvious intended meaning.
1454These are controlled by configuration and by \fBtrackname_\fR preferences.
460b9539 1455.PP
1456In addition there are two built-in parts, \fBpath\fR which is the whole path
1457name and \fBext\fR which is the filename extension, including the initial dot
1458(or the empty string if there is not extension).
1459.SH "SEE ALSO"
0d350ff0 1460\fBdisorder\fR(1), \fBsox\fR(1), \fBdisorderd\fR(8), \fBdisorder\-dump\fR(8),
460b9539 1461\fBpcrepattern\fR(3)
1462.\" Local Variables:
1463.\" mode:nroff
1464.\" fill-column:79
1465.\" End: