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