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