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