chiark / gitweb /
Restore breadcrumb trail to choose.tmpl
[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 ~\fRUSERNAME\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.\fRUSERNAME
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 cookie_key_lifetime \fISECONDS\fR
372 Lifetime of the signing key used in constructing cookies.  The default is one
373 week.
374 .TP
375 .B cookie_login_lifetime \fISECONDS\fR
376 Lifetime of a cookie enforced by the server.  When the cookie expires the user
377 will have to log in again even if their browser has remembered the cookie that
378 long.  The default is one day.
379 .TP
380 .B default_rights \fIRIGHTS\fR
381 Defines the set of rights given to new users.
382 The argument is a comma-separated list of rights.
383 For the possible values see
384 .B "Users And Access Control"
385 above.
386 .IP
387 The default is to allow everything except \fBadmin\fR and \fBregister\fR
388 (modified in legacy configurations by the obsolete \fBrestrict\fR directive).
389 .TP
390 .B device \fINAME\fR
391 Sound output device.
392 .IP
393 For \fBapi oss\fR this is the path to the device to use.
394 If it is set to \fBdefault\fR then \fI/dev/dsp\fR and \fI/dev/audio\fR
395 will be tried.
396 .IP
397 For \fBapi alsa\fR this is the device name to use.
398 .IP
399 For \fBapi coreaudio\fR this is currently ignored.
400 .IP
401 The default is \fBdefault\fR, which is intended to map to whatever the system's
402 default is.
403 .TP
404 .B gap \fISECONDS\fR
405 Specifies the number of seconds to leave between tracks.
406 The default is 0.
407 .IP
408 NB this option currently DOES NOT WORK.  If there is genuine demand it might be
409 reinstated.
410 .TP
411 .B history \fIINTEGER\fR
412 Specifies the number of recently played tracks to remember (including
413 failed tracks and scratches).
414 .TP
415 .B listen \fR[\fIHOST\fR] \fISERVICE\fR
416 Listen for connections on the address specified by \fIHOST\fR and port
417 specified by \fISERVICE\fR.
418 If \fIHOST\fR is omitted then listens on all local addresses.
419 .IP
420 Normally the server only listens on a UNIX domain socket.
421 .TP
422 .B lock yes\fR|\fBno
423 Determines whether the server locks against concurrent operation.
424 Default is \fByes\fR.
425 There is no good reason to set this to \fBno\fR and the option will
426 probably be removed in a future version.
427 .TP
428 .B mixer \fIDEVICE\fR
429 The mixer device name, if it needs to be specified separately from
430 \fBdevice\fR.
431 .IP
432 For \fBapi oss\fR this should be the path to the mixer device and the default
433 is \fI/dev/mixer\fR.
434 .IP
435 For \fBapi alsa\fR, this is the index of the mixer control to use.
436 The default is 0.
437 .IP
438 For \fBapi coreaudio\fR, volume setting is not currently supported.
439 .TP
440 .B multicast_loop yes\fR|\fBno
441 Determines whether multicast packets are loop backed to the sending host.
442 The default is \fByes\fR.
443 This only applies if \fBapi\fR is set to \fBnetwork\fR and \fBbroadcast\fR
444 is actually a multicast address.
445 .TP
446 .B multicast_ttl \fIHOPS\fR
447 Set the maximum number of hops to send multicast packets.
448 This only applies if \fBapi\fR is set to \fBnetwork\fR and
449 \fBbroadcast\fR is actually a multicast address.
450 The default is 1.
451 .TP
452 .B namepart \fIPART\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
453 Determines how to extract trackname part \fIPART\fR from a 
454 track name (with the collection root part removed).
455 Used in \fB@recent@\fR, \fB@playing@\fR and \fB@search@\fR.
456 .IP
457 Track names can be different in different contexts.
458 For instance the sort string might include an initial track number,
459 but this would be stripped for the display string.
460 \fICONTEXT\fR should be a glob pattern matching the
461 contexts in which this directive will be used.
462 .IP
463 Valid contexts are \fBsort\fR and \fBdisplay\fR.
464 .IP
465 All the \fBnamepart\fR directives are considered in order.
466 The first directive for the right part, that matches the desired context,
467 and with a \fIREGEXP\fR that
468 matches the track is used, and the value chosen is constructed from
469 \fISUBST\fR according to the substitution rules below.
470 .IP
471 Note that searches use the raw track name and \fBtrackname_\fR preferences but
472 not (currently) the results of \fBnamepart\fR, so generating words via this option
473 that aren't in the original track name will lead to confusing results.
474 .IP
475 If you supply no \fBnamepart\fR directives at all then a default set will be
476 supplied automatically.
477 But if you supply even one then you must supply all of them.
478 The defaults are equivalent to:
479 .PP
480 .nf
481 namepart title  "/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
482 namepart title  "/([^/]+)\\.[a-zA-Z0-9]+$"                  $1 sort
483 namepart album  "/([^/]+)/[^/]+$"                          $1 *
484 namepart artist "/([^/]+)/[^/]+/[^/]+$"                    $1 *
485 namepart ext    "(\\.[a-zA-Z0-9]+)$"                        $1 *
486 .fi
487 .TP
488 .B new_max \fIMAX\fR
489 The maximum number of tracks to list when reporting newly noticed tracks.
490 The default is 100.
491 .TP
492 .B nice_rescan \fIPRIORITY\fR
493 Set the recan subprocess priority.
494 The default is 10.
495 .IP
496 (Note that higher values mean the process gets less CPU time; UNIX priority
497 values are backwards.)
498 .TP
499 .B nice_server \fIPRIORITY\fR
500 Set the server priority.
501 This is applied to the server at startup time (and not when you reload
502 configuration).
503 The server does not use much CPU itself but this value is inherited
504 by programs it executes.
505 If you have limited CPU then it might help to set this to a small
506 negative value.
507 The default is 0.
508 .TP
509 .B nice_speaker \fIPRIORITY\fR
510 Set the speaker process priority.
511 This is applied to the speaker process at startup time (and not when
512 you reload the configuration).
513 The speaker process is not massively CPU intensive by today's
514 standards but depends on reasonably timely scheduling.
515 If you have limited CPU then it might help to set this to a small
516 negative value.
517 The default is 0.
518 .TP
519 .B noticed_history
520 The maximum days that a track can survive in the database of newly added
521 tracks.
522 The default is 31.
523 .TP
524 .B player \fIPATTERN\fR \fIMODULE\fR [\fIOPTIONS.. [\fB\-\-\fR]] \fIARGS\fR...
525 Specifies the player for files matching the glob \fIPATTERN\fR.
526 \fIMODULE\fR specifies which plugin module to use.
527 .IP
528 The following options are supported:
529 .RS
530 .TP
531 .B \-\-wait\-for\-device\fR[\fB=\fIDEVICE\fR]
532 Waits (for up to a couple of seconds) for the default, or specified, libao
533 device to become openable.
534 .TP
535 .B \-\-
536 Defines the end of the list of options.
537 Needed if the first argument to the plugin starts with a "\-".
538 .RE
539 .IP
540 The following are the standard modules:
541 .RS
542 .TP
543 .B exec \fICOMMAND\fR \fIARGS\fR...
544 The command is executed via \fBexecvp\fR(3), not via the shell.
545 The \fBPATH\fR environment variable is searched for the executable if it is not
546 an absolute path.
547 The command is expected to know how to open its own sound device.
548 .TP
549 .B execraw \fICOMMAND\fR \fIARGS\fR...
550 Identical to the \fBexec\fR except that the player is expected to use the
551 DisOrder raw player protocol.
552 .BR disorder-decode (8)
553 can decode several common audio file formats to this format.
554 If your favourite format is not supported, but you have a player
555 which uses libao, there is also a libao driver which supports this format;
556 see below for more information about this.
557 .TP
558 .B shell \fR[\fISHELL\fR] \fICOMMAND\fR
559 The command is executed using the shell.
560 If \fISHELL\fR is specified then that is used, otherwise \fBsh\fR will be used.
561 In either case the \fBPATH\fR environment variable is searched for the shell
562 executable if it is not an absolute path.
563 The track name is stored in the environment variable
564 \fBTRACK\fR.
565 .IP
566 Be careful of the interaction between the configuration file quoting rules and
567 the shell quoting rules.
568 .RE
569 .IP
570 If multiple player commands match a track then the first match is used.
571 .IP
572 For the server to be able to calculate track lengths, there should be a
573 .B tracklength
574 command corresponding to each
575 .B player
576 command.
577 .IP
578 If
579 .B player
580 is used without arguments, the list of players is cleared.
581 .TP
582 .B prefsync \fISECONDS\fR
583 The interval at which the preferences log file will be synchronised.
584 Defaults to 3600, i.e. one hour.
585 .TP
586 .B queue_pad \fICOUNT\fR
587 The target size of the queue.
588 If random play is enabled then randomly picked tracks will be added until
589 the queue is at least this big.
590 The default is 10.
591 .TP
592 .B reminder_interval \fISECONDS\fR
593 The minimum number of seconds that must elapse between password reminders.
594 The default is 600, i.e. 10 minutes.
595 .TP
596 .B remote_userman yes\fR|\fBno
597 User management over TCP connection is only allowed if this is set to
598 \fByes\fR.  By default it is set to \fBno\fR.
599 .TP
600 .B replay_min \fISECONDS\fR
601 The minimum number of seconds that must elapse after a track has been played
602 before it can be picked at random.  The default is 8 hours.  If this is set to
603 0 then there is no limit, though current \fBdisorder-choose\fR will not pick
604 anything currently listed in the recently-played list.
605 .TP
606 .B sample_format \fIBITS\fB/\fIRATE\fB/\fICHANNELS
607 Describes the sample format expected by the \fBspeaker_command\fR (below).
608 The components of the format specification are as follows:
609 .RS
610 .TP 10
611 .I BITS
612 The number of bits per sample.
613 Optionally, may be suffixed by \fBb\fR or \fBl\fR for big-endian and
614 little-endian words.
615 If neither is used the native byte order is assumed.
616 .TP
617 .I RATE
618 The number of samples per second.
619 .TP
620 .I CHANNELS
621 The number of channels.
622 .PP
623 The default is
624 .BR 16/44100/2 .
625 .PP
626 With the
627 .B network
628 backend the sample format is forced to
629 .B 16b/44100/2
630 and with the
631 .B coreaudio
632 backend it is forced to
633 .BR 16/44100/2 ,
634 in both cases regardless of what is specified in the configuration file.
635 .RE
636 .TP
637 .B signal \fINAME\fR
638 Defines the signal to be sent to track player process groups when tracks are
639 scratched.
640 The default is \fBSIGKILL\fR.
641 .IP
642 Signals are specified by their full C name, i.e. \fBSIGINT\fR and not \fBINT\fR
643 or \fBInterrupted\fR or whatever.
644 .TP
645 .B sox_generation \fB0\fR|\fB1
646 Determines whether calls to \fBsox\fR(1) should use \fB\-b\fR, \fB\-x\fR, etc (if
647 the generation is 0) or \fB\-\fIbits\fR, \fB\-L\fR etc (if it is 1).
648 See the documentation for your installed copy of \fBsox\fR to determine
649 which you need.
650 The default is 0.
651 .TP
652 .B speaker_backend \fINAME
653 This is an alias for \fBapi\fR; see above.
654 .TP
655 .B speaker_command \fICOMMAND
656 Causes the speaker subprocess to pipe audio data into shell command
657 \fICOMMAND\fR, rather than writing to a local sound card.
658 The sample format is determine by
659 .B sample_format
660 above.
661 .IP
662 Note that if the sample format is wrong then
663 .BR sox (1)
664 is invoked to translate it.
665 If
666 .B sox
667 is not installed then this will not work.
668 .TP
669 .B scratch \fIPATH\fR
670 Specifies a scratch.
671 When a track is scratched, a scratch track is played at random.
672 Scratches are played using the same logic as other tracks.
673 .IP
674 At least for the time being, path names of scratches must be encoded using
675 UTF-8 (which means that ASCII will do).
676 .IP
677 If \fBscratch\fR is used without arguments then the list of scratches is
678 cleared.
679 .TP
680 .B stopword \fIWORD\fR ...
681 Specifies one or more stopwords that should not take part in searches
682 over track names.
683 .IP
684 If \fBstopword\fR is used without arguments then the list of stopwords is
685 cleared.
686 .IP
687 There is a default set of stopwords built in, but this option can be used to
688 augment or replace that list.
689 .TP
690 .B tracklength \fIPATTERN\fR \fIMODULE\fR
691 Specifies the module used to calculate the length of files matching
692 \fIPATTERN\fR.
693 \fIMODULE\fR specifies which plugin module to use.
694 .IP
695 If \fBtracklength\fR is used without arguments then the list of modules is
696 cleared.
697 .TP
698 .B user \fIUSERNAME\fR
699 Specifies the user to run as.
700 Only makes sense if invoked as root (or the target user).
701 .SS "Client Configuration"
702 .TP
703 .B connect \fIHOST SERVICE\fR
704 Connect to the address specified by \fIHOST\fR and port specified by
705 \fISERVICE\fR.
706 .SS "Web Interface Configuration"
707 .TP
708 .B mail_sender \fIADDRESS\fR
709 The email address that appears in the From: field of any mail messages sent by
710 the web interface.
711 This must be set if you have online registration enabled.
712 .TP
713 .B refresh \fISECONDS\fR
714 Specifies the maximum refresh period in seconds.
715 Default 15.
716 .TP
717 .B short_display \fICHARACTERS\fR
718 Defines the maximum number of characters to include in a \fBshort\fR name
719 part.
720 Default 30.
721 .TP
722 .B smtp_server \fIHOSTNAME\fR
723 The hostname (or address) of the SMTP server to use for sending mail.
724 The default is 127.0.0.1.
725 .TP
726 .B templates \fIPATH\fR ...
727 Specifies the directory containing templates used by the web
728 interface.
729 If a template appears in more than one template directory
730 then the one in the earliest directory specified is chosen.
731 .IP
732 See below for further details.
733 .IP
734 If \fBtemplates\fR is used without arguments then the template path is cleared.
735 .TP
736 .B transform \fITYPE\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
737 Determines how names are sorted and displayed in track choice displays.
738 .IP
739 \fITYPE\fR is the type of transformation; usually \fBtrack\fR or
740 \fBdir\fR but you can define your own.
741 .IP
742 \fICONTEXT\fR is a glob pattern matching the context.
743 Standard contexts are \fBsort\fR (which determines how directory names
744 are sorted) and \fBdisplay\fR (which determines how they are displayed).
745 Again, you can define your own.
746 .IP
747 All the \fBtransform\fR directives are considered in order.
748 If the \fITYPE\fR, \fIREGEXP\fR and the \fICONTEXT\fR match
749 then a new track name is constructed from
750 \fISUBST\fR according to the substitution rules below.
751 If several match then each is executed in order.
752 .IP
753 If you supply no \fBtransform\fR directives at all then a default set will be
754 supplied automatically.
755 But if you supply even one then you must supply all of them.
756 The defaults are:
757 .PP
758 .nf
759 transform track "^.*/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
760 transform track "^.*/([^/]+)\\.[a-zA-Z0-9]+$"        $1 sort
761 transform dir   "^.*/([^/]+)$"                      $1 *
762 transform dir   "^(the) ([^/]*)"                    "$2 $1" sort i
763 transform dir   "[[:punct:]]"                       "" sort g
764 .fi
765 .TP
766 .B url \fIURL\fR
767 Specifies the URL of the web interface.
768 This URL will be used in generated web pages.
769 The default is inferred at runtime, so this option no
770 longer needs to be specified.
771 .IP
772 This must be the full URL, e.g. \fBhttp://myhost/cgi-bin/jukebox\fR and not
773 \fB/cgi-bin/jukebox\fR.
774 .SS "Authentication Configuration"
775 These options would normally be used in \fI~\fRUSERNAME\fI/.disorder/passwd\fR
776 or
777 \fIpkgconfdir/config.\fRUSERNAME.
778 .TP
779 .B password \fIPASSWORD\fR
780 Specify password.
781 .TP
782 .B username \fIUSERNAME\fR
783 Specify username.
784 The default is taken from the environment variable \fBLOGNAME\fR.
785 .SH "GLOBAL PREFERENCES"
786 These are the values set with \fBset\-global\fR.
787 .TP
788 .B required\-tags
789 If this is set an nonempty then randomly played tracks will always have at
790 least one of the listed tags.
791 .TP
792 .B prohibited\-tags
793 If this is set an nonempty then randomly played tracks will never have any of
794 the listed tags.
795 .TP
796 .B playing
797 If unset or \fByes\fR then play is enabled.
798 Otherwise it is disabled.
799 Use \fBdisable\fR rather than setting it directly.
800 .TP
801 .B random\-play
802 If unset or \fByes\fR then random play is enabled.
803 Otherwise it is disabled.
804 Use \fBdisable\fR rather than setting it directly.
805 .PP
806 Global preferences starting '_' are read-only (in the sense that you cannot
807 modify them; the server may modify them as part of its normal operation).
808 They are:
809 .TP
810 .B _dbversion
811 The database version string.
812 This is used by DisOrder to detect when it must
813 modify the database after an upgrade.
814 .SH "LIBAO DRIVER"
815 .SS "Raw Protocol Players"
816 Raw protocol players are expected to use the \fBdisorder\fR libao driver.
817 Programs that use libao generally have command line options to select the
818 driver and pass options to it.
819 .SS "Driver Options"
820 The known driver options are:
821 .TP
822 .B fd
823 The file descriptor to write to.
824 If this is not specified then the driver looks like the environment
825 variable \fBDISORDER_RAW_FD\fR.
826 If that is not set then the default is 1 (i.e. standard output).
827 .TP
828 .B fragile
829 If this is set to a nonzero value then the driver will call \fB_exit\fR(2) if a
830 write to the output file descriptor fails.
831 This is a workaround for buggy players such as \fBogg123\fR that ignore
832 write errors.
833 .SH "WEB TEMPLATES"
834 When \fBdisorder.cgi\fR wants to generate a page for action ACTION, it looks
835 for ACTION.tmpl first in pkgconfdir and then in pkgdatadir.  Customization can
836 be achieved by copy the desired templates to pkgconfdir and editing.  (Leave
837 the ones in pkgdatadir alone, they will be overwritten on upgrade.)
838 .PP
839 The supplied templates are:
840 .TP
841 .B about.tmpl
842 Display information about DisOrder.
843 .TP
844 .B choose.tmpl
845 Navigates through the track database to choose a track to play.
846 .TP
847 .B login.tmpl
848 The login page.
849 .TP
850 .B new.tmpl
851 Lists newly added tracks.
852 .TP
853 .B playing.tmpl
854 The "front page", which usually shows the currently playing tracks and
855 the queue.
856 Gets an HTTP \fBRefresh\fR header.
857 .IP
858 If the \fBmgmt\fR CGI argument is set to \fBtrue\fR then we include extra
859 buttons for moving tracks up and down in the queue.
860 There is some logic in \fBdisorder.cgi\fR to ensure that \fBmgmt=true\fR
861 is preserved across refreshes and redirects back into itself, but
862 URLs embedded in web pages must include it explicitly.
863 .TP
864 .B prefs.tmpl
865 Views preferences.
866 If the \fBfile\fR, \fBname\fR and \fBvalue\fR arguments are
867 all set then that preference is modified; if \fBfile\fR and \fBname\fR are set
868 but not \fBvalue\fR then the preference is deleted.
869 .TP
870 .B recent.tmpl
871 Lists recently played tracks.
872 .PP
873 See \fBdisorder_templates\fR(5) for the syntax of template files.
874 .SH "WEB OPTIONS"
875 This is a file called \fIoptions\fR, searched for in the same manner
876 as templates.
877 It includes numerous options for the control of the web interface.
878 The general syntax is the same as the main configuration
879 file, except that it should be encoded using UTF-8 (though this might
880 change to the current locale's character encoding; stick to ASCII to
881 be safe).
882 .PP
883 The shipped \fIoptions\fR file includes four standard options files.
884 In order, they are:
885 .TP
886 .I options.labels
887 The default labels file.
888 You wouldn't normally edit this directly - instead supply your own commands
889 in \fIoptions.user\fR.
890 Have a look at the shipped version of the file for documentation of
891 labels used by the standard templates.
892 .TP
893 .I options.user
894 A user options file.
895 Here you should put any overrides for the default labels and any
896 extra labels required by your modified templates.
897 .PP
898 Valid directives are:
899 .TP
900 .B columns \fINAME\fR \fIHEADING\fR...
901 Defines the columns used in \fB@playing@\fR and \fB@recent@\fB.
902 \fINAME\fR must be either \fBplaying\fR, \fBrecent\fR or \fBsearch\fR.
903 \fIHEADING\fR...  is a list of heading names.
904 If a column is defined more than once then the last definitions is used.
905 .IP
906 The heading names \fBbutton\fR, \fBlength\fR, \fBwhen\fR and \fBwho\fR
907 are built in.
908 .TP
909 .B include \fIPATH\fR
910 Includes another file.
911 If \fIPATH\fR starts with a \fB/\fR then it is taken as is, otherwise
912 it is searched for in the template path.
913 .TP
914 .B label \fINAME\fR \fIVALUE\fR
915 Define a label.
916 If a label is defined more than once then the last definition is used.
917 .SS Labels
918 Some labels are defined inside \fBdisorder.cgi\fR and others by the
919 default templates.
920 You can define your own labels and use them inside a template.
921 .PP
922 When an undefined label is expanded, if it has a dot in its name then
923 the part after the final dot is used as its value.
924 Otherwise the whole name is used as the value.
925 .PP
926 Labels are no longer documented here, see the shipped \fIoptions.labels\fR file
927 instead.
928 .SH "ACTIONS"
929 What the web interface actually does is terminated by the \fBaction\fR CGI
930 argument.
931 The values listed below are supported.
932 .PP
933 Except as specified, all actions redirect back to the \fBplaying.html\fR
934 template unless the \fBback\fR argument is present, in which case the URL it
935 gives is used instead.
936 .PP
937 Redirection to \fBplaying.html\fR preserves \fBmgmt=true\fR if it is present.
938 .TP 8
939 .B "move"
940 Move track \fBid\fR by offset \fBdelta\fR.
941 .TP
942 .B "play"
943 Play track \fBfile\fR, or if that is missing then play all the tracks in
944 \fBdirectory\fR.
945 .TP
946 .B "playing"
947 Don't change any state, but instead compute a suitable refresh time and include
948 that in an HTTP header.
949 Expands the \fBplaying.html\fR template rather than redirecting.
950 .IP
951 This is the default if \fBaction\fR is missing.
952 .TP
953 .B "random\-disable"
954 Disables random play.
955 .TP
956 .B "random\-enable"
957 Enables random play.
958 .TP
959 .B "disable"
960 Disables play completely.
961 .TP
962 .B "enable"
963 Enables play.
964 .TP
965 .B "pause"
966 Pauses the current track.
967 .TP
968 .B "remove"
969 Remove track \fBid\fR.
970 .TP
971 .B "resume"
972 Resumes play after a pause.
973 .TP
974 .B "scratch"
975 Scratch the playing track.
976 If \fBid\fR is present it must match the playing track.
977 .TP
978 .B "volume"
979 Change the volume by \fBdelta\fR, or if that is missing then set it to the
980 values of \fBleft\fR and \fBright\fR.
981 Expands to the \fBvolume.html\fR template rather than redirecting.
982 .TP
983 .B "prefs"
984 Adjust preferences from the \fBprefs.html\fR template (which it then expands
985 rather than redirecting).
986 .IP
987 If
988 .B parts
989 is set then the cooked interface is assumed.
990 The value of
991 .B parts
992 is used to determine which trackname preferences are set.
993 By default the
994 .B display
995 context is adjusted but this can be overridden with the
996 .B context
997 argument.
998 Also the
999 .B random
1000 argument is checked; if it is set then random play is enabled for that track,
1001 otherwise it is disabled.
1002 .IP
1003 Otherwise if the
1004 .B name
1005 and
1006 .B value
1007 arguments are set then they are used to set a single preference.
1008 .IP
1009 Otherwise if just the
1010 .B name
1011 argument is set then that preference is deleted.
1012 .IP
1013 It is recommended that links to the \fBprefs\fR action use \fB@resolve@\fR to
1014 enure that the real track name is always used.
1015 Otherwise if the preferences page is used to adjust a trackname_ preference,
1016 the alias may change, leading to the URL going stale.
1017 .TP
1018 .B "error"
1019 This action is generated automatically when an error occurs connecting to the
1020 server.
1021 The \fBerror\fR label is set to an indication of what the error is.
1022 .SH "REGEXP SUBSTITUTION RULES"
1023 Regexps are PCRE regexps, as defined in \fBpcrepattern\fR(3).
1024 The only option used is \fBPCRE_UTF8\fR.
1025 Remember that the configuration file syntax means you have to
1026 escape backslashes and quotes inside quoted strings.
1027 .PP
1028 In a \fISUBST\fR string the following sequences are interpreted
1029 specially:
1030 .TP
1031 .B $1 \fR... \fB$9
1032 These expand to the first to ninth bracketed subexpression.
1033 .TP
1034 .B $&
1035 This expands to the matched part of the subject string.
1036 .TP
1037 .B $$
1038 This expands to a single \fB$\fR symbol.
1039 .PP
1040 All other pairs starting with \fB$\fR are undefined (and might be used
1041 for something else in the future, so don't rely on the current
1042 behaviour.)
1043 .PP
1044 If \fBi\fR is present in \fIREFLAGS\fR then the match is case-independent.
1045 If \fBg\fR is present then all matches are replaced, otherwise only the first
1046 match is replaced.
1047 .SH "TRACK NAME PARTS"
1048 The traditional track name parts are \fBartist\fR, \fBalbum\fR and \fBtitle\fR,
1049 with the obvious intended meaning.
1050 These are controlled by configuration and by \fBtrackname_\fR preferences.
1051 .PP
1052 In addition there are two built-in parts, \fBpath\fR which is the whole path
1053 name and \fBext\fR which is the filename extension, including the initial dot
1054 (or the empty string if there is not extension).
1055 .SH "SEE ALSO"
1056 \fBdisorder\fR(1), \fBsox\fR(1), \fBdisorderd\fR(8), \fBdisorder\-dump\fR(8),
1057 \fBpcrepattern\fR(3), \fBdisorder_templates\fR(5)
1058 .\" Local Variables:
1059 .\" mode:nroff
1060 .\" fill-column:79
1061 .\" End: