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