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