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