chiark / gitweb /
Add many comments to server/play.c, in advance of possible
[disorder] / doc / disorder_config.5.in
CommitLineData
460b9539 1.\"
b50cfb8a 2.\" Copyright (C) 2004-2009 Richard Kettlewell
460b9539 3.\"
e7eb3a27 4.\" This program is free software: you can redistribute it and/or modify
460b9539 5.\" it under the terms of the GNU General Public License as published by
e7eb3a27 6.\" the Free Software Foundation, either version 3 of the License, or
460b9539 7.\" (at your option) any later version.
e7eb3a27
RK
8.\"
9.\" This program is distributed in the hope that it will be useful,
10.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.\" GNU General Public License for more details.
13.\"
460b9539 14.\" You should have received a copy of the GNU General Public License
e7eb3a27 15.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 16.\"
17.TH disorder_config 5
18.SH NAME
19pkgconfdir/config - DisOrder jukebox configuration
20.SH DESCRIPTION
21The purpose of DisOrder is to organize and play digital audio files, under the
c0c23a60 22control of multiple users.
00753f26
RK
23\fIpkgconfdir/config\fR is the primary configuration file; the web interface
24uses a number of others (see \fBdisorder.cgi\fR(8)).
460b9539 25.SS Tracks
26DisOrder can be configured with multiple collections of tracks, indexing them
27by their filename, and picking players on the basis of filename patterns (for
28instance, "*.mp3").
29.PP
30Although the model is of filenames, it is not inherent that there are
31corresponding real files - merely that they can be interpreted by the chosen
c0c23a60
RK
32player.
33See \fBdisorder\fR(3) for more details about this.
460b9539 34.PP
c0c23a60
RK
35Each track can have a set of preferences associated with it.
36These are simple key-value pairs; they can be used for anything you
37like, but a number of keys have specific meanings.
3d1452ab 38See \fBdisorder_preferences\fR(5) for more details about these.
460b9539 39.SS "Track Names"
40Track names are derived from filenames under the control of regular
41expressions, rather than attempting to interpret format-specific embedded name
c0c23a60
RK
42information.
43They can be overridden by setting preferences.
460b9539 44.PP
45Names for display are distinguished from names for sorting, so with the right
46underlying filenames an album can be displayed in its original order even if
47the displayed track titles are not lexically sorted.
48.SS "Server State"
49A collection of global preferences define various bits of server state: whether
50random play is enabled, what tags to check for when picking at random, etc.
3d1452ab 51See \fBdisorder_preferences\fR(5) for more information.
460b9539 52.SS "Users And Access Control"
c0c23a60
RK
53DisOrder distinguishes between multiple users.
54This is for access control and reporting, not to provide different
55views of the world: i.e. preferences and so on are global.
460b9539 56.PP
eb5dc014 57Each user has an associated set of rights which contorl which commands they may
c0c23a60
RK
58execute.
59Normally you would give all users most rights, and expect them to
eb5dc014
RK
60cooperate (they are after all presumed to be in a shared sound environment).
61.PP
62The full set of rights are:
63.TP
64.B read
65User can perform read-only operations
66.TP
67.B play
68User can add tracks to the queue
69.TP
70.B "move any"
71User can move any track
72.TP
73.B "move mine"
74User can move their own tracks
75.TP
76.B "move random"
77User can move randomly chosen tracks
78.TP
79.B "remove any"
80User can remove any track
81.TP
82.B "remove mine"
83User can remove their own tracks
84.TP
85.B "remove random"
86User can remove randomly chosen tracks
87.TP
88.B "scratch any"
89User can scratch any track
90.TP
91.B "scratch mine"
92User can scratch their own tracks
93.TP
94.B "scratch random"
95User can scratch randomly chosen tracks
96.TP
97.B volume
98User can change the volume
99.TP
100.B admin
101User can perform admin operations
102.TP
103.B rescan
104User can initiate a rescan
105.TP
106.B register
c0c23a60
RK
107User can register new users.
108Normally only the
eb5dc014
RK
109.B guest
110user would have this right.
111.TP
112.B userinfo
113User can edit their own userinfo
114.TP
115.B prefs
116User can modify track preferences
117.TP
118.B "global prefs"
119User can modify global preferences
120.TP
121.B pause
122User can pause/resume
460b9539 123.PP
c0c23a60
RK
124Access control is entirely used-based.
125If you configure DisOrder to listen for TCP/IP connections then it will
126accept a connection from anywhere provided the right password is
127available.
128Passwords are never transmitted over TCP/IP connections in clear,
129but everything else is.
130The expected model is that host-based access control is imposed at
131the network layer.
460b9539 132.SS "Web Interface"
133The web interface is controlled by a collection of template files, one for each
c0c23a60
RK
134kind of page, and a collection of option files.
135These are split up and separate from the main configuration file to
5c1ae3bc
RK
136.PP
137See \fBdisorder.cgi\fR(8) for more information.
180dcdb0 138.SS "Searching And Tags"
c0c23a60
RK
139Search strings contain a list of search terms separated by spaces.
140A search term can either be a single word or a tag, prefixed with "tag:".
180dcdb0
RK
141.PP
142Search words are compared without regard to letter case or accents; thus, all
143of the following will be considered to be equal to one another:
144.PP
145.nf
146 LATIN CAPITAL LETTER E
147 LATIN SMALL LETTER E
148 LATIN CAPITAL LETTER E WITH GRAVE
149 LATIN SMALL LETTER E WITH GRAVE
150 LATIN CAPITAL LETTER E plus COMBINING GRAVE ACCENT
151 LATIN SMALL LETTER E plus COMBINING GRAVE ACCENT
152.fi
153.PP
154The same rules apply to tags but in addition leading and trailing whitespace is
155disregarded and all whitespace sequences are treated as equal when they appear
156as internal whitespace.
157.PP
158Where several tags are listed, for instance the tags preference for a track,
c0c23a60
RK
159the tags are separated by commas.
160Therefore tags may not contain commas.
460b9539 161.SH "CONFIGURATION FILE"
162.SS "General Syntax"
163Lines are split into fields separated by whitespace (space, tab, line
c0c23a60
RK
164feed, carriage return, form feed).
165Comments are started by the number sign ("#").
460b9539 166.PP
167Fields may be unquoted (in which case they may not contain spaces and
168may not start with a quotation mark or apostrophe) or quoted by either
c0c23a60
RK
169quotation marks or apostrophes.
170Inside quoted fields every character stands for itself, except that
171a backslash can only appear as part of one of the following escape sequences:
460b9539 172.TP
173.B \e\e
174Backslash
175.TP
176.B \e"
177Quotation mark
178.\" "
179.TP
180.B \e'
181Apostrophe
182.TP
183.B \en
184Line feed
185.PP
186No other escape sequences are allowed.
187.PP
188Within any line the first field is a configuration command and any
c0c23a60
RK
189further fields are parameters.
190Lines with no fields are ignored.
460b9539 191.PP
192After editing the config file use \fBdisorder reconfigure\fR to make
c0c23a60
RK
193it re-read it.
194If there is anything wrong with it the daemon will record a log
195message and ignore the new config file.
196(You should fix it before next terminating and restarting the daemon,
197as it cannot start up without a valid config file.)
eb5dc014
RK
198.SS "Configuration Files"
199Configuration files are read in the following order:
200.TP
201.I pkgconfdir/config
202.TP
203.I pkgconfdir/config.private
c0c23a60
RK
204Should be readable only by the jukebox group.
205Not really useful any more and will be abolished in future.
eb5dc014 206.TP
90ad6c6e 207.I ~\fRUSERNAME\fI/.disorder/passwd
c0c23a60
RK
208Per-user client configuration.
209Optional but if it exists must be readable only by the relevant user.
210Would normally contain a \fBpassword\fR directive.
5b14453f 211.TP
90ad6c6e 212.I pkgconfdir/config.\fRUSERNAME
c0c23a60
RK
213Per-user system-controlled client configuration.
214Optional but if it exists must be readable only by the relevant user.
215Would normally contain a \fBpassword\fR directive.
5b14453f
RK
216.IP
217The prefererred location for per-user passwords is \fI~/.disorder/passwd\fR and
c0c23a60 218\fBdisorder authorize\fR writes there now.
460b9539 219.SS "Global Configuration"
220.TP
221.B home \fIDIRECTORY\fR
c0c23a60
RK
222The home directory for state files.
223Defaults to
460b9539 224.IR pkgstatedir .
659d87e8 225The server will create this directory on startup if it does not exist.
460b9539 226.TP
0c6bcae0 227.B plugins \fIPATH\fR
c0c23a60
RK
228Adds a directory to the plugin path.
229(This is also used by the web interface.)
460b9539 230.IP
231Plugins are opened the first time they are required and never after,
232so after changing a plugin you must restart the server before it is
233guaranteed to take effect.
40c30921
RK
234.IP
235If
236.B plugins
237is used without arguments the plugin path is cleared.
460b9539 238.SS "Server Configuration"
239.TP
240.B alias \fIPATTERN\fR
241Defines the pattern use construct virtual filenames from \fBtrackname_\fR
242preferences.
243.IP
244Most characters stand for themselves, the exception being \fB{\fR which is used
245to insert a track name part in the form \fB{\fIname\fB}\fR or
246\fB{/\fIname\fB}\fR.
247.IP
248The difference is that the first form just inserts the name part while the
249second prefixes it with a \fB/\fR if it is nonempty.
250.IP
251The pattern should not attempt to include the collection root, which is
252automatically included, but should include the proper extension.
253.IP
254The default is \fB{/artist}{/album}{/title}{ext}\fR.
255.TP
bd8895a8 256.B api \fINAME\fR
c0c23a60
RK
257Selects the backend used to play sound and to set the volume.
258The following options are available:
bd8895a8 259.RS
260.TP
261.B alsa
c0c23a60
RK
262Use the ALSA API.
263This is only available on Linux systems, on which it is the default.
bd8895a8 264.TP
265.B coreaudio
c0c23a60
RK
266Use Apple Core Audio.
267This only available on OS X systems, on which it is the default.
bd8895a8 268.TP
269.B oss
c0c23a60
RK
270Use the OSS (/dev/dsp) API.
271Not available on all platforms.
bd8895a8 272.TP
273.B command
c0c23a60
RK
274Execute a command.
275This is the default if
bd8895a8 276.B speaker_command
277is specified, or if no native is available.
f75ab9d3
RK
278.IP
279You might want to set
280.B pause_mode
281with this backend.
bd8895a8 282.TP
b50cfb8a 283.B rtp
c0c23a60
RK
284Transmit audio over the network.
285This is the default if \fBbroadcast\fR is specified.
286You can use
bd8895a8 287.BR disorder-playrtp (1)
288to receive and play the resulting stream on Linux and OS X.
b50cfb8a
RK
289.B network
290is a deprecated synonym for this API.
bd8895a8 291.RE
292.TP
25ca855b 293.B authorization_algorithm \fIALGORITHM\fR
c0c23a60
RK
294Defines the algorithm used to authenticate clients.
295The valid options are sha1 (the default), sha256, sha384 and sha512.
296See
637fdea3
RK
297.BR disorder_protocol (5)
298for more details.
299.TP
9053adc9 300.B broadcast \fR[\fIFAMILY\fR] \fIADDRESS\fR \fIPORT\fR
c0c23a60 301Transmit sound data to \fIADDRESS\fR using UDP port \fIPORT\fR.
b50cfb8a 302This implies \fBapi rtp\fR.
61941295 303.IP
9053adc9
RK
304\fIFAMILY\fR can be \fB-4\fR or \fB-6\fR to force IPv4 or IPv6, if this is not
305implied by \fIADDRESS\fR.
306Note that IPv6 is not currently well tested.
307.IP
61941295 308See also \fBmulticast_loop\fR and \fBmulticast_ttl\fR.
30ad4dab 309.TP
9053adc9 310.B broadcast_from \fR[\fIFAMILY\fR] \fIADDRESS\fR \fIPORT\fR
30ad4dab 311Sets the (local) source address used by \fBbroadcast\fR.
9053adc9
RK
312.IP
313\fIFAMILY\fR can be \fB-4\fR or \fB-6\fR to force IPv4 or IPv6, if this is not
314implied by \fIADDRESS\fR.
315Note that IPv6 is not currently well tested.
30ad4dab 316.TP
460b9539 317.B channel \fICHANNEL\fR
bd8895a8 318The mixer channel that the volume control should use.
319.IP
320For \fBapi oss\fR the possible values are:
460b9539 321.RS
322.TP 8
323.B pcm
9053adc9 324
c0c23a60
RK
325Output level for the audio device.
326This is probably what you want and is the default.
460b9539 327.TP
328.B speaker
329Output level for the PC speaker, if that is connected to the sound card.
330.TP
331.B pcm2
332Output level for alternative codec device.
333.TP
334.B vol
c0c23a60
RK
335Master output level.
336The OSS documentation recommends against using this, as it affects all
337output devices.
460b9539 338.RE
339.IP
bd8895a8 340You can also specify channels by number, if you know the right value.
341.IP
c0c23a60
RK
342For \fBapi alsa\fR, this is the name of the mixer control to use.
343The default is \fBPCM\fR.
344Use \fBamixer scontrols\fR or similar to get a full list.
bd8895a8 345.IP
346For \fBapi coreaudio\fR, volume setting is not currently supported.
460b9539 347.TP
348.B collection \fIMODULE\fR \fIENCODING\fR \fIROOT\fR
01cef138
RK
349.TP
350.B collection \fIMODULE\fR \fIROOT\fR
351.TP
352.B collection \fIROOT\fR
460b9539 353Define a collection of tracks.
354.IP
355\fIMODULE\fR defines which plugin module should be used for this
c0c23a60
RK
356collection.
357Use the supplied \fBfs\fR module for tracks that exist as ordinary
358files in the filesystem.
359If no \fIMODULE\fR is specified then \fBfs\fR is assumed.
360.IP
361\fIENCODING\fR defines the encoding of filenames in this collection.
362For \fBfs\fR this would be the encoding you use for filenames.
0d350ff0 363Examples might be \fBiso\-8859\-1\fR or \fButf\-8\fR.
c0c23a60
RK
364If no encoding is specified then the current locale's character encoding
365is used.
460b9539 366.IP
01cef138
RK
367NB that this default depends on the locale the server runs in, which is not
368necessarily the same as that of ordinary users, depending how the system is
c0c23a60
RK
369configured.
370It's best to explicitly specify it to be certain.
460b9539 371.IP
372\fIROOT\fR is the root in the filesystem of the filenames and is
c0c23a60
RK
373passed to the plugin module.
374It must be an absolute path and should not end with a "/".
460b9539 375.TP
dafbdc04
RK
376.B cookie_key_lifetime \fISECONDS\fR
377Lifetime of the signing key used in constructing cookies. The default is one
378week.
379.TP
380.B cookie_login_lifetime \fISECONDS\fR
381Lifetime of a cookie enforced by the server. When the cookie expires the user
382will have to log in again even if their browser has remembered the cookie that
383long. The default is one day.
384.TP
04e1fa7c 385.B default_rights \fIRIGHTS\fR
c0c23a60
RK
386Defines the set of rights given to new users.
387The argument is a comma-separated list of rights.
388For the possible values see
04e1fa7c
RK
389.B "Users And Access Control"
390above.
391.IP
392The default is to allow everything except \fBadmin\fR and \fBregister\fR
393(modified in legacy configurations by the obsolete \fBrestrict\fR directive).
394.TP
460b9539 395.B device \fINAME\fR
bd8895a8 396Sound output device.
397.IP
c0c23a60
RK
398For \fBapi oss\fR this is the path to the device to use.
399If it is set to \fBdefault\fR then \fI/dev/dsp\fR and \fI/dev/audio\fR
400will be tried.
bd8895a8 401.IP
402For \fBapi alsa\fR this is the device name to use.
403.IP
f5fd9a6b
RK
404For \fBapi coreaudio\fR this can be either the UID or the human-readable
405name of the desired device.
406For a list of names, visit System Preferences -> Sound and look at the Type column.
407For example, you might use "Built-in Output" for the built-in speaker
408or "Built-in Line Output" if you have connected external speakers.
409Remember to quote the name.
bd8895a8 410.IP
b25aac59 411The default is \fBdefault\fR, which is intended to map to whatever the system's
412default is.
460b9539 413.TP
414.B gap \fISECONDS\fR
c0c23a60
RK
415Specifies the number of seconds to leave between tracks.
416The default is 0.
49a773eb
RK
417.IP
418NB this option currently DOES NOT WORK. If there is genuine demand it might be
419reinstated.
460b9539 420.TP
421.B history \fIINTEGER\fR
422Specifies the number of recently played tracks to remember (including
423failed tracks and scratches).
424.TP
9053adc9 425.B listen \fR[\fIFAMILY\fR] \fR[\fIHOST\fR] \fISERVICE\fR
460b9539 426Listen for connections on the address specified by \fIHOST\fR and port
c0c23a60 427specified by \fISERVICE\fR.
9053adc9
RK
428If \fIHOST\fR is omitted, or is \fB*\fR, then listens on all local addresses.
429.IP
430\fIFAMILY\fR can be \fB-4\fR or \fB-6\fR to force IPv4 or IPv6, if this is not
431implied by \fIHOST\fR.
432Note that IPv6 is not currently well tested.
460b9539 433.IP
434Normally the server only listens on a UNIX domain socket.
435.TP
436.B lock yes\fR|\fBno
c0c23a60
RK
437Determines whether the server locks against concurrent operation.
438Default is \fByes\fR.
439There is no good reason to set this to \fBno\fR and the option will
25ca855b 440probably be removed in a future version.
460b9539 441.TP
bd8895a8 442.B mixer \fIDEVICE\fR
443The mixer device name, if it needs to be specified separately from
444\fBdevice\fR.
445.IP
446For \fBapi oss\fR this should be the path to the mixer device and the default
447is \fI/dev/mixer\fR.
448.IP
c0c23a60
RK
449For \fBapi alsa\fR, this is the index of the mixer control to use.
450The default is 0.
bd8895a8 451.IP
452For \fBapi coreaudio\fR, volume setting is not currently supported.
460b9539 453.TP
61941295 454.B multicast_loop yes\fR|\fBno
c0c23a60
RK
455Determines whether multicast packets are loop backed to the sending host.
456The default is \fByes\fR.
b50cfb8a 457This only applies if \fBapi\fR is set to \fBrtp\fR and \fBbroadcast\fR
c0c23a60 458is actually a multicast address.
61941295 459.TP
23205f9c 460.B multicast_ttl \fIHOPS\fR
c0c23a60 461Set the maximum number of hops to send multicast packets.
b50cfb8a 462This only applies if \fBapi\fR is set to \fBrtp\fR and
c0c23a60
RK
463\fBbroadcast\fR is actually a multicast address.
464The default is 1.
23205f9c 465.TP
460b9539 466.B namepart \fIPART\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
467Determines how to extract trackname part \fIPART\fR from a
468track name (with the collection root part removed).
469Used in \fB@recent@\fR, \fB@playing@\fR and \fB@search@\fR.
470.IP
c0c23a60
RK
471Track names can be different in different contexts.
472For instance the sort string might include an initial track number,
473but this would be stripped for the display string.
474\fICONTEXT\fR should be a glob pattern matching the
460b9539 475contexts in which this directive will be used.
476.IP
477Valid contexts are \fBsort\fR and \fBdisplay\fR.
478.IP
c0c23a60
RK
479All the \fBnamepart\fR directives are considered in order.
480The first directive for the right part, that matches the desired context,
460b9539 481and with a \fIREGEXP\fR that
482matches the track is used, and the value chosen is constructed from
483\fISUBST\fR according to the substitution rules below.
484.IP
485Note that searches use the raw track name and \fBtrackname_\fR preferences but
486not (currently) the results of \fBnamepart\fR, so generating words via this option
487that aren't in the original track name will lead to confusing results.
488.IP
489If you supply no \fBnamepart\fR directives at all then a default set will be
c0c23a60
RK
490supplied automatically.
491But if you supply even one then you must supply all of them.
492The defaults are equivalent to:
25ca855b
RK
493.PP
494.nf
495namepart title "/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
496namepart title "/([^/]+)\\.[a-zA-Z0-9]+$" $1 sort
497namepart album "/([^/]+)/[^/]+$" $1 *
498namepart artist "/([^/]+)/[^/]+/[^/]+$" $1 *
499namepart ext "(\\.[a-zA-Z0-9]+)$" $1 *
500.fi
460b9539 501.TP
05dcfac6
RK
502.B new_bias \fIWEIGHT\fR
503The weight for new tracks.
6151ae7e 504The default is 450000, i.e. recently added tracks are a fifty times as likely
05dcfac6
RK
505to be picked as normal.
506.TP
507.B new_bias_age \fISECONDS\fR
508The maximum age of tracks that \fBnew_bias\fR applies to, in seconds.
509The default is one week.
510.TP
d742bb47 511.B new_max \fIMAX\fR
c0c23a60
RK
512The maximum number of tracks to list when reporting newly noticed tracks.
513The default is 100.
d742bb47 514.TP
460b9539 515.B nice_rescan \fIPRIORITY\fR
c0c23a60
RK
516Set the recan subprocess priority.
517The default is 10.
460b9539 518.IP
519(Note that higher values mean the process gets less CPU time; UNIX priority
04e42396 520values are backwards.)
460b9539 521.TP
522.B nice_server \fIPRIORITY\fR
c0c23a60
RK
523Set the server priority.
524This is applied to the server at startup time (and not when you reload
525configuration).
526The server does not use much CPU itself but this value is inherited
527by programs it executes.
528If you have limited CPU then it might help to set this to a small
529negative value.
530The default is 0.
460b9539 531.TP
532.B nice_speaker \fIPRIORITY\fR
c0c23a60
RK
533Set the speaker process priority.
534This is applied to the speaker process at startup time (and not when
535you reload the configuration).
536The speaker process is not massively CPU intensive by today's
537standards but depends on reasonably timely scheduling.
538If you have limited CPU then it might help to set this to a small
539negative value.
540The default is 0.
460b9539 541.TP
2a10b70b
RK
542.B noticed_history
543The maximum days that a track can survive in the database of newly added
c0c23a60
RK
544tracks.
545The default is 31.
2a10b70b 546.TP
f75ab9d3
RK
547.B pause_mode \fIMODE
548Sets the pause mode for the \fBcommand\fR backend.
549The possible values are:
550.RS
551.TP
552.B silence
553Send silent (0-value) samples when paused.
554This is the default.
555.TP
556.B suspend
557Stop writing when paused.
558.RE
559.TP
0d350ff0 560.B player \fIPATTERN\fR \fIMODULE\fR [\fIOPTIONS.. [\fB\-\-\fR]] \fIARGS\fR...
c0c23a60
RK
561Specifies the player for files matching the glob \fIPATTERN\fR.
562\fIMODULE\fR specifies which plugin module to use.
460b9539 563.IP
564The following options are supported:
565.RS
566.TP
0d350ff0 567.B \-\-wait\-for\-device\fR[\fB=\fIDEVICE\fR]
8c37e83b
RK
568\fBThis option is deprecated\fR.
569If you want gapless play use raw-format players and the speaker process instead.
570(This the default in any case.)
571.IP
460b9539 572Waits (for up to a couple of seconds) for the default, or specified, libao
573device to become openable.
574.TP
0d350ff0 575.B \-\-
c0c23a60 576Defines the end of the list of options.
0d350ff0 577Needed if the first argument to the plugin starts with a "\-".
460b9539 578.RE
579.IP
580The following are the standard modules:
581.RS
582.TP
583.B exec \fICOMMAND\fR \fIARGS\fR...
584The command is executed via \fBexecvp\fR(3), not via the shell.
585The \fBPATH\fR environment variable is searched for the executable if it is not
586an absolute path.
587The command is expected to know how to open its own sound device.
588.TP
589.B execraw \fICOMMAND\fR \fIARGS\fR...
590Identical to the \fBexec\fR except that the player is expected to use the
ce6c36be 591DisOrder raw player protocol.
592.BR disorder-decode (8)
c0c23a60
RK
593can decode several common audio file formats to this format.
594If your favourite format is not supported, but you have a player
595which uses libao, there is also a libao driver which supports this format;
596see below for more information about this.
460b9539 597.TP
598.B shell \fR[\fISHELL\fR] \fICOMMAND\fR
c0c23a60
RK
599The command is executed using the shell.
600If \fISHELL\fR is specified then that is used, otherwise \fBsh\fR will be used.
601In either case the \fBPATH\fR environment variable is searched for the shell
602executable if it is not an absolute path.
603The track name is stored in the environment variable
460b9539 604\fBTRACK\fR.
605.IP
606Be careful of the interaction between the configuration file quoting rules and
607the shell quoting rules.
608.RE
609.IP
610If multiple player commands match a track then the first match is used.
62dc3748
RK
611.IP
612For the server to be able to calculate track lengths, there should be a
613.B tracklength
614command corresponding to each
615.B player
616command.
40c30921
RK
617.IP
618If
619.B player
620is used without arguments, the list of players is cleared.
460b9539 621.TP
622.B prefsync \fISECONDS\fR
c0c23a60
RK
623The interval at which the preferences log file will be synchronised.
624Defaults to 3600, i.e. one hour.
460b9539 625.TP
459d4402 626.B queue_pad \fICOUNT\fR
c0c23a60
RK
627The target size of the queue.
628If random play is enabled then randomly picked tracks will be added until
629the queue is at least this big.
630The default is 10.
459d4402 631.TP
6207d2f3 632.B reminder_interval \fISECONDS\fR
c0c23a60
RK
633The minimum number of seconds that must elapse between password reminders.
634The default is 600, i.e. 10 minutes.
6207d2f3 635.TP
810b8083
RK
636.B remote_userman yes\fR|\fBno
637User management over TCP connection is only allowed if this is set to
638\fByes\fR. By default it is set to \fBno\fR.
639.TP
cebe3127
RK
640.B replay_min \fISECONDS\fR
641The minimum number of seconds that must elapse after a track has been played
642before it can be picked at random. The default is 8 hours. If this is set to
6430 then there is no limit, though current \fBdisorder-choose\fR will not pick
644anything currently listed in the recently-played list.
645.TP
405fea4e 646.B sample_format \fIBITS\fB/\fIRATE\fB/\fICHANNELS
c0c23a60
RK
647Describes the sample format expected by the \fBspeaker_command\fR (below).
648The components of the format specification are as follows:
405fea4e 649.RS
650.TP 10
651.I BITS
c0c23a60
RK
652The number of bits per sample.
653Optionally, may be suffixed by \fBb\fR or \fBl\fR for big-endian and
654little-endian words.
655If neither is used the native byte order is assumed.
405fea4e 656.TP
657.I RATE
658The number of samples per second.
659.TP
660.I CHANNELS
661The number of channels.
662.PP
663The default is
664.BR 16/44100/2 .
937be4c0
RK
665.PP
666With the
b50cfb8a 667.B rtp
937be4c0 668backend the sample format is forced to
e99d42b1 669.B 16b/44100/2
937be4c0
RK
670and with the
671.B coreaudio
672backend it is forced to
673.BR 16/44100/2 ,
674in both cases regardless of what is specified in the configuration file.
405fea4e 675.RE
676.TP
460b9539 677.B signal \fINAME\fR
678Defines the signal to be sent to track player process groups when tracks are
c0c23a60
RK
679scratched.
680The default is \fBSIGKILL\fR.
460b9539 681.IP
682Signals are specified by their full C name, i.e. \fBSIGINT\fR and not \fBINT\fR
683or \fBInterrupted\fR or whatever.
684.TP
5330d674 685.B sox_generation \fB0\fR|\fB1
0d350ff0
RK
686Determines whether calls to \fBsox\fR(1) should use \fB\-b\fR, \fB\-x\fR, etc (if
687the generation is 0) or \fB\-\fIbits\fR, \fB\-L\fR etc (if it is 1).
c0c23a60
RK
688See the documentation for your installed copy of \fBsox\fR to determine
689which you need.
419893d7
RK
690The default is set according to the version of sox found when DisOrder was
691built.
692If you run on a system with a different version of sox, you will need to
693set this option.
5330d674 694.TP
bd8895a8 695.B speaker_backend \fINAME
696This is an alias for \fBapi\fR; see above.
697.TP
405fea4e 698.B speaker_command \fICOMMAND
699Causes the speaker subprocess to pipe audio data into shell command
c0c23a60
RK
700\fICOMMAND\fR, rather than writing to a local sound card.
701The sample format is determine by
405fea4e 702.B sample_format
703above.
77cfc7a2 704.IP
705Note that if the sample format is wrong then
706.BR sox (1)
c0c23a60
RK
707is invoked to translate it.
708If
77cfc7a2 709.B sox
710is not installed then this will not work.
405fea4e 711.TP
460b9539 712.B scratch \fIPATH\fR
c0c23a60
RK
713Specifies a scratch.
714When a track is scratched, a scratch track is played at random.
460b9539 715Scratches are played using the same logic as other tracks.
716.IP
717At least for the time being, path names of scratches must be encoded using
718UTF-8 (which means that ASCII will do).
40c30921
RK
719.IP
720If \fBscratch\fR is used without arguments then the list of scratches is
721cleared.
460b9539 722.TP
723.B stopword \fIWORD\fR ...
724Specifies one or more stopwords that should not take part in searches
725over track names.
40c30921
RK
726.IP
727If \fBstopword\fR is used without arguments then the list of stopwords is
728cleared.
86be0c30 729.IP
730There is a default set of stopwords built in, but this option can be used to
731augment or replace that list.
62dc3748
RK
732.TP
733.B tracklength \fIPATTERN\fR \fIMODULE\fR
734Specifies the module used to calculate the length of files matching
c0c23a60
RK
735\fIPATTERN\fR.
736\fIMODULE\fR specifies which plugin module to use.
40c30921
RK
737.IP
738If \fBtracklength\fR is used without arguments then the list of modules is
739cleared.
eb5dc014 740.TP
90ad6c6e 741.B user \fIUSERNAME\fR
c0c23a60
RK
742Specifies the user to run as.
743Only makes sense if invoked as root (or the target user).
460b9539 744.SS "Client Configuration"
00753f26
RK
745These options would normally be used in \fI~\fRUSERNAME\fI/.disorder/passwd\fR
746or
747\fIpkgconfdir/config.\fRUSERNAME.
460b9539 748.TP
9053adc9 749.B connect \fR[\fIFAMILY\fR] \fIHOST SERVICE\fR
460b9539 750Connect to the address specified by \fIHOST\fR and port specified by
ccf0aafa 751\fISERVICE\fR.
9053adc9
RK
752.IP
753\fIFAMILY\fR can be \fB-4\fR or \fB-6\fR to force IPv4 or IPv6, if this is not
754implied by \fIHOST\fR.
755Note that IPv6 is not currently well tested.
00753f26
RK
756.TP
757.B password \fIPASSWORD\fR
758Specify password.
759.TP
760.B username \fIUSERNAME\fR
761Specify username.
3d1452ab 762The default is inferred from the current UID.
460b9539 763.SS "Web Interface Configuration"
00753f26 764.\" TODO this section is misnamed really...
460b9539 765.TP
e70701e7 766.B mail_sender \fIADDRESS\fR
767The email address that appears in the From: field of any mail messages sent by
c0c23a60
RK
768the web interface.
769This must be set if you have online registration enabled.
e70701e7 770.TP
460b9539 771.B refresh \fISECONDS\fR
c0c23a60
RK
772Specifies the maximum refresh period in seconds.
773Default 15.
460b9539 774.TP
2eee4b0c
RK
775.B sendmail \fIPATH\fR
776The path to the Sendmail executable.
777This must support the \fB-bs\fR option (Postfix, Exim and Sendmail should all
778work).
779The default is the sendmail executable found at compile time.
780.TP
61507e3c
RK
781.B short_display \fICHARACTERS\fR
782Defines the maximum number of characters to include in a \fBshort\fR name
c0c23a60
RK
783part.
784Default 30.
61507e3c 785.TP
e70701e7 786.B smtp_server \fIHOSTNAME\fR
c0c23a60
RK
787The hostname (or address) of the SMTP server to use for sending mail.
788The default is 127.0.0.1.
2eee4b0c 789If \fBsendmail\fR is set then that is used instead.
e70701e7 790.TP
460b9539 791.B transform \fITYPE\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]]
792Determines how names are sorted and displayed in track choice displays.
793.IP
794\fITYPE\fR is the type of transformation; usually \fBtrack\fR or
795\fBdir\fR but you can define your own.
796.IP
c0c23a60
RK
797\fICONTEXT\fR is a glob pattern matching the context.
798Standard contexts are \fBsort\fR (which determines how directory names
799are sorted) and \fBdisplay\fR (which determines how they are displayed).
800Again, you can define your own.
460b9539 801.IP
c0c23a60
RK
802All the \fBtransform\fR directives are considered in order.
803If the \fITYPE\fR, \fIREGEXP\fR and the \fICONTEXT\fR match
460b9539 804then a new track name is constructed from
c0c23a60
RK
805\fISUBST\fR according to the substitution rules below.
806If several match then each is executed in order.
460b9539 807.IP
808If you supply no \fBtransform\fR directives at all then a default set will be
c0c23a60
RK
809supplied automatically.
810But if you supply even one then you must supply all of them.
811The defaults are:
25ca855b
RK
812.PP
813.nf
814transform track "^.*/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$" $2 display
815transform track "^.*/([^/]+)\\.[a-zA-Z0-9]+$" $1 sort
816transform dir "^.*/([^/]+)$" $1 *
817transform dir "^(the) ([^/]*)" "$2 $1" sort i
818transform dir "[[:punct:]]" "" sort g
819.fi
460b9539 820.TP
821.B url \fIURL\fR
c0c23a60
RK
822Specifies the URL of the web interface.
823This URL will be used in generated web pages.
824The default is inferred at runtime, so this option no
b64c2805 825longer needs to be specified.
460b9539 826.IP
827This must be the full URL, e.g. \fBhttp://myhost/cgi-bin/jukebox\fR and not
828\fB/cgi-bin/jukebox\fR.
460b9539 829.SH "GLOBAL PREFERENCES"
460b9539 830.SH "LIBAO DRIVER"
831.SS "Raw Protocol Players"
832Raw protocol players are expected to use the \fBdisorder\fR libao driver.
833Programs that use libao generally have command line options to select the
834driver and pass options to it.
835.SS "Driver Options"
836The known driver options are:
837.TP
838.B fd
c0c23a60
RK
839The file descriptor to write to.
840If this is not specified then the driver looks like the environment
841variable \fBDISORDER_RAW_FD\fR.
842If that is not set then the default is 1 (i.e. standard output).
460b9539 843.TP
844.B fragile
845If this is set to a nonzero value then the driver will call \fB_exit\fR(2) if a
c0c23a60
RK
846write to the output file descriptor fails.
847This is a workaround for buggy players such as \fBogg123\fR that ignore
848write errors.
3e1616b6
RK
849.SH "REGEXP SUBSTITUTION RULES"
850Regexps are PCRE regexps, as defined in \fBpcrepattern\fR(3).
851The only option used is \fBPCRE_UTF8\fR.
852Remember that the configuration file syntax means you have to
853escape backslashes and quotes inside quoted strings.
854.PP
855In a \fISUBST\fR string the following sequences are interpreted
856specially:
857.TP
858.B $1 \fR... \fB$9
859These expand to the first to ninth bracketed subexpression.
860.TP
861.B $&
862This expands to the matched part of the subject string.
863.TP
864.B $$
865This expands to a single \fB$\fR symbol.
866.PP
867All other pairs starting with \fB$\fR are undefined (and might be used
868for something else in the future, so don't rely on the current
869behaviour.)
870.PP
871If \fBi\fR is present in \fIREFLAGS\fR then the match is case-independent.
872If \fBg\fR is present then all matches are replaced, otherwise only the first
873match is replaced.
460b9539 874.SH "TRACK NAME PARTS"
875The traditional track name parts are \fBartist\fR, \fBalbum\fR and \fBtitle\fR,
c0c23a60
RK
876with the obvious intended meaning.
877These are controlled by configuration and by \fBtrackname_\fR preferences.
460b9539 878.PP
879In addition there are two built-in parts, \fBpath\fR which is the whole path
880name and \fBext\fR which is the filename extension, including the initial dot
881(or the empty string if there is not extension).
882.SH "SEE ALSO"
0d350ff0 883\fBdisorder\fR(1), \fBsox\fR(1), \fBdisorderd\fR(8), \fBdisorder\-dump\fR(8),
5c1ae3bc 884\fBpcrepattern\fR(3), \fBdisorder_templates\fR(5), \fBdisorder_actions\fR(5),
3d1452ab 885\fBdisorder.cgi\fR(8), \fBdisorder_preferences\fR(5)
460b9539 886.\" Local Variables:
887.\" mode:nroff
888.\" fill-column:79
889.\" End: