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