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