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