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