Commit | Line | Data |
---|---|---|
460b9539 | 1 | .\" |
b7de606b | 2 | .\" Copyright (C) 2004-2011 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_protocol 5 | |
18 | .SH NAME | |
19 | disorder_protocol \- DisOrder communication protocol | |
20 | .SH DESCRIPTION | |
21 | The DisOrder client and server communicate via the protocol described | |
22 | in this man page. | |
23 | .PP | |
b7de606b RK |
24 | The protocol is usually modified in each new version of the server. |
25 | .SH "MESSAGE STRUCTURE" | |
26 | A \fIline\fR is a sequence of printable Unicode characters encoded in UTF-8 and | |
27 | terminated by the octet 0x0A. | |
28 | Note that unlike some other protocols, a carriage return is not used as part of | |
29 | the end-of-line sequence. | |
30 | .PP | |
31 | A \fIcommand message\fR consists of a \fIcommand line\fR followed, in some cases, by a \fIbody\fR. | |
32 | Similarly a \fIresponse message\fR consists of a \fIresponse line\fR followed | |
33 | sometimes by a \fIbody\fR. | |
460b9539 | 34 | .PP |
b7de606b RK |
35 | A \fIbody\fR consists of a sequence of dot-stuffed lines followed by a line |
36 | containing a single full stop character. | |
37 | Dot-stuffing means that any line in the body starting with a full stop have | |
38 | another full stop inserted at the start prior to transmission, and removed | |
39 | again after reception. | |
460b9539 | 40 | .PP |
b7de606b RK |
41 | Whether a command message includes a body depends on the specific command being |
42 | sent; see below for details. | |
43 | This is also true of reply messages, although it is guaranteed that if the is a | |
44 | response body then the reply status code (see below) will end with the digit 3. | |
460b9539 | 45 | .PP |
b7de606b RK |
46 | Command lines, and some response lines, are split into \fIfields\fR. |
47 | Fields are separated by one or more spaces and may be \fIunquoted\fR or | |
48 | \fIquoted\fR. | |
fc80bbcd | 49 | .PP |
b7de606b RK |
50 | An \fIunquoted field\fR can contain any (non-control) characters except for a |
51 | space, quotation mark or apostrophe. | |
52 | They are always at least one character long. | |
53 | .PP | |
54 | A \fIquoted field\fR begins with a quotation mark or apostrophe and is | |
55 | terminated by the same character. | |
56 | Any occurrence of the backslash or the surrounding quotation mark must be | |
57 | escaped. | |
58 | The full set of escapes permitted is: | |
59 | .TP | |
60 | .B \e\e | |
61 | Backslash | |
62 | .TP | |
63 | .B \e" | |
64 | Quotation mark | |
65 | .\" " | |
66 | .TP | |
67 | .B \e\(aq | |
68 | Apostrophe | |
69 | .TP | |
70 | .B \en | |
71 | Line feed | |
fc80bbcd | 72 | .PP |
460b9539 | 73 | .SH COMMANDS |
b7de606b | 74 | Commands always have a command name as the first field of the line. |
460b9539 | 75 | .PP |
76 | All commands require the connection to have been already authenticated unless | |
c0c23a60 | 77 | stated otherwise. |
b7de606b | 78 | See \fBAUTHENTICATION\fR below. |
c0c23a60 RK |
79 | If not stated otherwise, the \fBread\fR right is sufficient to execute |
80 | the command. | |
460b9539 | 81 | .TP |
0f55e905 | 82 | .B adduser \fIUSERNAME PASSWORD \fR[\fIRIGHTS\fR] |
c0c23a60 RK |
83 | Create a new user with the given username and password. |
84 | The new user's rights list can be specified; if it is not | |
85 | then the \fBdefault_rights\fR setting applies instead. | |
86 | Requires the \fBadmin\fR right, and only works on local | |
0f55e905 | 87 | connections. |
eb5dc014 | 88 | .TP |
d42e98ca RK |
89 | .B adopt \fIID\fR |
90 | Adopts a randomly picked track, leaving it in a similar state to if it was | |
91 | picked by this user. Requires the \fBplay\fR right. | |
92 | .TP | |
460b9539 | 93 | .B allfiles \fIDIRECTORY\fR [\fIREGEXP\fR] |
5818980a | 94 | List all the files and directories in \fIDIRECTORY\fR in a response body. |
460b9539 | 95 | If \fIREGEXP\fR is present only matching files and directories are returned. |
96 | .TP | |
ba39faf6 | 97 | .B confirm \fICONFIRMATION |
c0c23a60 RK |
98 | Confirm user registration. |
99 | \fICONFIRMATION\fR is as returned from \fBregister\fR below. | |
531a8ecd RK |
100 | This command logs the user in. |
101 | The response contains the logged-in username. | |
ba39faf6 | 102 | .TP |
eb5dc014 | 103 | .B cookie \fICOOKIE |
0d350ff0 | 104 | Log a user back in using a cookie created with \fBmake\-cookie\fR. |
c0c23a60 | 105 | The response contains the username. |
eb5dc014 RK |
106 | .TP |
107 | .B deluser \fIUSERNAME | |
c0c23a60 RK |
108 | Delete the named user. |
109 | Requires the \fBadmin\fR right, and only works on local connections. | |
460b9539 | 110 | .TP |
111 | .B dirs \fIDIRECTORY\fR [\fIREGEXP\fR] | |
5818980a | 112 | List all the directories in \fIDIRECTORY\fR in a response body. |
460b9539 | 113 | If \fIREGEXP\fR is present only matching directories are returned. |
114 | .TP | |
115 | .B disable \fR[\fBnow\fR] | |
c0c23a60 RK |
116 | Disable further playing. |
117 | If the optional \fBnow\fR argument is present then the current track | |
118 | is stopped. | |
119 | Requires the \fBglobal prefs\fR right. | |
eb5dc014 RK |
120 | .TP |
121 | .B edituser \fIUSERNAME PROPERTY VALUE | |
c0c23a60 RK |
122 | Set a user property. |
123 | With the \fBadmin\fR right any username and property may be specified. | |
124 | Otherwise the \fBuserinfo\fR right is required and only the | |
eb5dc014 | 125 | \fBemail\fR and \fBpassword\fR properties may be set. |
0517868c RK |
126 | .IP |
127 | User properties are syntax-checked before setting. For instance \fBemail\fR | |
128 | must contain an "@" sign or you will get an error. (Setting an empty value for | |
129 | \fBemail\fR is allowed and removes the property.) | |
b7de606b RK |
130 | .IP |
131 | See \fBUSER PROPERTIES\fR below. | |
460b9539 | 132 | .TP |
133 | .B enable | |
c0c23a60 RK |
134 | Re-enable further playing, and is the opposite of \fBdisable\fR. |
135 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 136 | .TP |
137 | .B enabled | |
c0c23a60 RK |
138 | Report whether playing is enabled. |
139 | The second field of the response line will be \fByes\fR or \fBno\fR. | |
460b9539 | 140 | .TP |
141 | .B exists \fITRACK\fR | |
c0c23a60 RK |
142 | Report whether the named track exists. |
143 | The second field of the response line will be \fByes\fR or \fBno\fR. | |
460b9539 | 144 | .TP |
145 | .B files \fIDIRECTORY\fR [\fIREGEXP\fR] | |
5818980a | 146 | List all the files in \fIDIRECTORY\fR in a response body. |
460b9539 | 147 | If \fIREGEXP\fR is present only matching files are returned. |
148 | .TP | |
149 | .B get \fITRACK\fR \fIPREF\fR | |
97b2a06f | 150 | Gets a preference value. |
c0c23a60 | 151 | On success the second field of the response line will have the value. |
fb1bc1f5 RK |
152 | .IP |
153 | If the track or preference do not exist then the response code is 555. | |
460b9539 | 154 | .TP |
0d350ff0 | 155 | .B get\-global \fIKEY\fR |
460b9539 | 156 | Get a global preference. |
fb1bc1f5 RK |
157 | .IP |
158 | If the preference does not exist then the response code is 555. | |
460b9539 | 159 | .TP |
160 | .B length \fITRACK\fR | |
c0c23a60 RK |
161 | Get the length of the track in seconds. |
162 | On success the second field of the response line will have the value. | |
460b9539 | 163 | .TP |
164 | .B log | |
c0c23a60 RK |
165 | Send event log messages in a response body. |
166 | The command will never terminate. | |
167 | Any further data sent to the server will be discarded (explicitly; | |
168 | i.e. it will not accumulate in a buffer somewhere). | |
460b9539 | 169 | .IP |
170 | See \fBEVENT LOG\fR below for more details. | |
171 | .TP | |
0d350ff0 | 172 | .B make\-cookie |
eb5dc014 RK |
173 | Returns an opaque string that can be used by the \fBcookie\fR command to log |
174 | this user back in on another connection (until the cookie expires). | |
175 | .TP | |
460b9539 | 176 | .B move \fITRACK\fR \fIDELTA\fR |
c0c23a60 RK |
177 | Move a track in the queue. |
178 | The track may be identified by ID (preferred) or name (which might cause | |
179 | confusion if it's there twice). | |
180 | \fIDELTA\fR should be an negative or positive integer and indicates how | |
181 | many steps towards the head of the queue the track should be moved. | |
eb5dc014 RK |
182 | .IP |
183 | Requires one of the \fBmove mine\fR, \fBmove random\fR or \fBmove any\fR rights | |
184 | depending on how the track came to be added to the queue. | |
460b9539 | 185 | .TP |
186 | .B moveafter \fITARGET\fR \fIID\fR ... | |
c0c23a60 RK |
187 | Move all the tracks in the \fIID\fR list after ID \fITARGET\fR. |
188 | If \fITARGET\fR is the empty string then the listed tracks are put | |
189 | at the head of the queue. | |
190 | If \fITARGET\fR is listed in the ID list then the tracks are moved | |
460b9539 | 191 | to just after the first non-listed track before it, or to the head if there is |
192 | no such track. | |
eb5dc014 RK |
193 | .IP |
194 | Requires one of the \fBmove mine\fR, \fBmove random\fR or \fBmove any\fR rights | |
195 | depending on how the tracks came to be added to the queue. | |
460b9539 | 196 | .TP |
2a10b70b | 197 | .B new \fR[\fIMAX\fR] |
c0c23a60 | 198 | Send the most recently added \fIMAX\fR tracks in a response body. |
c03fbc77 | 199 | If the argument is omitted, the \fBnew_max\fR most recent tracks are |
c0c23a60 | 200 | listed (see \fBdisorder_config\fR(5)). |
2a10b70b | 201 | .TP |
7858930d | 202 | .B nop |
c0c23a60 RK |
203 | Do nothing. |
204 | Used by | |
7858930d | 205 | .BR disobedience (1) |
c0c23a60 RK |
206 | as a keepalive measure. |
207 | This command does not require authentication. | |
7858930d | 208 | .TP |
460b9539 | 209 | .B part \fITRACK\fR \fICONTEXT\fI \fIPART\fR |
c0c23a60 RK |
210 | Get a track name part. |
211 | Returns an empty string if a name part cannot be constructed. | |
460b9539 | 212 | .IP |
213 | .I CONTEXT | |
214 | is one of | |
215 | .B sort | |
216 | or | |
217 | .B display | |
218 | and | |
219 | .I PART | |
220 | is usually one of | |
221 | .BR artist , | |
222 | .B album | |
223 | or | |
224 | .BR title . | |
225 | .TP | |
226 | .B pause | |
c0c23a60 RK |
227 | Pause the current track. |
228 | Requires the \fBpause\fR right. | |
460b9539 | 229 | .TP |
230 | .B play \fITRACK\fR | |
c0c23a60 RK |
231 | Add a track to the queue. |
232 | The response contains the queue ID of the track. | |
eb5dc014 | 233 | Requires the \fBplay\fR right. |
460b9539 | 234 | .TP |
7a853280 RK |
235 | .B playafter \fITARGET\fR \fITRACK\fR ... |
236 | Add all the tracks in the \fITRACK\fR list to the queue after \fITARGET\fR | |
237 | (which should be a track ID). | |
238 | If \fITARGET\fR is the empty string then the listed tracks are put | |
239 | at the head of the queue. | |
240 | .IP | |
241 | Currently the success result does \fInot\fR include the new track IDs. | |
242 | .IP | |
243 | Requires the \fBplay\fR right. | |
244 | .TP | |
460b9539 | 245 | .B playing |
5818980a | 246 | Report what track is playing. |
460b9539 | 247 | .IP |
248 | If the response is \fB252\fR then the rest of the response line consists of | |
249 | track information (see below). | |
250 | .IP | |
251 | If the response is \fB259\fR then nothing is playing. | |
252 | .TP | |
fc80bbcd RK |
253 | .B playlist-delete \fIPLAYLIST\fR |
254 | Delete a playlist. | |
255 | Requires permission to modify that playlist and the \fBplay\fR right. | |
256 | .TP | |
257 | .B playlist-get \fIPLAYLIST\fR | |
258 | Get the contents of a playlist, in a response body. | |
259 | Requires permission to read that playlist and the \fBread\fR right. | |
2d88ddf4 | 260 | If the playlist does not exist the response is 555. |
fc80bbcd RK |
261 | .TP |
262 | .B playlist-get-share \fIPLAYLIST\fR | |
263 | Get the sharing status of a playlist. | |
264 | The result will be \fBpublic\fR, \fBprivate\fR or \fBshared\fR. | |
265 | Requires permission to read that playlist and the \fBread\fR right. | |
266 | .TP | |
267 | .B playlist-lock \fIPLAYLIST\fR | |
268 | Lock a playlist. | |
269 | Requires permission to modify that playlist and the \fBplay\fR right. | |
270 | Only one playlist may be locked at a time on a given connection and the lock | |
271 | automatically expires when the connection is closed. | |
272 | .TP | |
273 | .B playlist-set \fIPLAYLIST\fR | |
274 | Set the contents of a playlist. | |
275 | The new contents should be supplied in a command body. | |
276 | Requires permission to modify that playlist and the \fBplay\fR right. | |
277 | The playlist must be locked. | |
278 | .TP | |
279 | .B playlist-set-share \fIPLAYLIST\fR \fISHARE\fR | |
280 | Set the sharing status of a playlist to | |
281 | \fBpublic\fR, \fBprivate\fR or \fBshared\fR. | |
282 | Requires permission to modify that playlist and the \fBplay\fR right. | |
283 | .TP | |
284 | .B playlist-unlock\fR | |
285 | Unlock the locked playlist. | |
286 | .TP | |
287 | .B playlists | |
288 | List all playlists that this connection has permission to read. | |
289 | Requires the \fBread\fR right. | |
290 | .TP | |
460b9539 | 291 | .B prefs \fBTRACK\fR |
5818980a | 292 | Send back the preferences for \fITRACK\fR in a response body. |
460b9539 | 293 | Each line of the response has the usual line syntax, the first field being the |
294 | name of the pref and the second the value. | |
295 | .TP | |
296 | .B queue | |
5818980a | 297 | Send back the current queue in a response body, one track to a line, the track |
c0c23a60 RK |
298 | at the head of the queue (i.e. next to be be played) first. |
299 | See below for the track information syntax. | |
460b9539 | 300 | .TP |
0d350ff0 | 301 | .B random\-disable |
c0c23a60 RK |
302 | Disable random play (but don't stop the current track). |
303 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 304 | .TP |
0d350ff0 | 305 | .B random\-enable |
c0c23a60 RK |
306 | Enable random play. |
307 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 308 | .TP |
0d350ff0 | 309 | .B random\-enabled |
c0c23a60 RK |
310 | Report whether random play is enabled. |
311 | The second field of the response line will be \fByes\fR or \fBno\fR. | |
460b9539 | 312 | .TP |
313 | .B recent | |
5818980a | 314 | Send back the current recently-played list in a response body, one track to a |
c0c23a60 RK |
315 | line, the track most recently played last. |
316 | See below for the track information syntax. | |
460b9539 | 317 | .TP |
318 | .B reconfigure | |
c0c23a60 RK |
319 | Request that DisOrder reconfigure itself. |
320 | Requires the \fBadmin\fR right. | |
863c04fa RK |
321 | .IP |
322 | Not all configuration options can be modified during the lifetime of the | |
323 | server; of those that can't, some will just be ignored if they change while | |
324 | others will cause the new configuration to be rejected. | |
325 | See \fBdisorder_config\fR(5) for details. | |
460b9539 | 326 | .TP |
90ad6c6e | 327 | .B register \fIUSERNAME PASSWORD EMAIL |
c0c23a60 RK |
328 | Register a new user. |
329 | Requires the \fBregister\fR right. | |
330 | The result contains a confirmation string; the user will be be able | |
331 | to log in until this has been presented back to the server via the | |
332 | \fBconfirm\fR command. | |
ba39faf6 | 333 | .TP |
90ad6c6e RK |
334 | .B reminder \fIUSERNAME\fR |
335 | Send a password reminder to user \fIUSERNAME\fR. | |
c0c23a60 RK |
336 | If the user has no valid email address, or no password, or a |
337 | reminder has been sent too recently, then no reminder will be sent. | |
6207d2f3 | 338 | .TP |
460b9539 | 339 | .B remove \fIID\fR |
c0c23a60 RK |
340 | Remove the track identified by \fIID\fR. |
341 | Requires one of the \fBremove mine\fR, \fBremove random\fR or | |
342 | \fBremove any\fR rights depending on how the | |
eb5dc014 | 343 | track came to be added to the queue. |
460b9539 | 344 | .TP |
dd9af5cb | 345 | .B rescan \fR[\fBwait\fR] \fR[\fBfresh\fR] |
c0c23a60 RK |
346 | Rescan all roots for new or obsolete tracks. |
347 | Requires the \fBrescan\fR right. | |
dd9af5cb RK |
348 | .IP |
349 | If the \fBwait\fR flag is present then the response is delayed until the rescan | |
350 | completes. | |
351 | Otherwise the response arrives immediately. | |
352 | This is primarily intended for testing. | |
353 | .IP | |
354 | If the \fBfresh\fR flag is present a rescan is already underway then a second | |
355 | rescan will be started when it completes. | |
356 | The default behavior is to piggyback on the existing rescan. | |
357 | .IP | |
358 | NB that \fBfresh\fR is currently disabled in the server source, so using this | |
359 | flag will just provoke an error. | |
460b9539 | 360 | .TP |
361 | .B resolve \fITRACK\fR | |
362 | Resolve a track name, i.e. if this is an alias then return the real track name. | |
363 | .TP | |
364 | .B resume | |
c0c23a60 RK |
365 | Resume the current track after a \fBpause\fR command. |
366 | Requires the \fBpause\fR right. | |
eb5dc014 | 367 | .TP |
0b5fb105 RK |
368 | .B revoke |
369 | Revoke the current login's cookie. | |
370 | It will not be possible to use the cookie in the future. | |
460b9539 | 371 | .TP |
0d350ff0 | 372 | .B rtp\-address |
5818980a | 373 | Report the RTP broadcast (or multicast) address, in the form \fIADDRESS |
c0c23a60 RK |
374 | PORT\fR. |
375 | This command does not require authentication. | |
ca831831 | 376 | .TP |
460b9539 | 377 | .B scratch \fR[\fIID\fR] |
378 | Remove the track identified by \fIID\fR, or the currently playing track if no | |
c0c23a60 RK |
379 | \fIID\fR is specified. |
380 | Requires one of the \fBscratch mine\fR, \fBscratch random\fR or | |
381 | \fBscratch any\fR rights depending on how the track came to be | |
eb5dc014 | 382 | added to the queue. |
460b9539 | 383 | .TP |
2b33c4cf RK |
384 | .B schedule-add \fIWHEN\fR \fIPRIORITY\fR \fIACTION\fR ... |
385 | Schedule an event for the future. | |
386 | .IP | |
387 | .I WHEN | |
b7de606b RK |
388 | is the time when it should happen, as a timestamp. |
389 | See \fBTIMESTAMPS\fR below. | |
2b33c4cf RK |
390 | It must refer to a time in the future. |
391 | .IP | |
392 | .I PRIORITY | |
393 | is the event priority. | |
394 | This can be \fBnormal\fR, in which case the event will be run at startup if its | |
395 | time has past, or \fBjunk\fR in which case it will be discarded if it is found | |
396 | to be in the past at startup. | |
397 | The meaning of other values is not defined. | |
398 | .IP | |
399 | .I ACTION | |
400 | is the action to perform. | |
401 | The choice of action determines the meaning of the remaining arguments. | |
402 | Possible actions are: | |
403 | .RS | |
404 | .TP | |
405 | .B play | |
406 | Play a track. | |
407 | The next argument is the track name. | |
408 | Requires the \fBplay\fR right. | |
409 | .TP | |
410 | .B set-global | |
411 | Set a global preference. | |
412 | The next argument is the preference name and the final argument is the value to | |
413 | set it to (omit it to unset it). | |
414 | Requires the \fBglobal prefs\fR right. | |
415 | .RE | |
416 | .IP | |
417 | You need the right at the point you create the event. | |
418 | It is not possible to create scheduled events in expectation of a future change | |
419 | in rights. | |
420 | .TP | |
421 | .B schedule-del \fIEVENT\fR | |
422 | Deletes a scheduled event. | |
423 | Users can always delete their own scheduled events; with the \fBadmin\fR | |
424 | right you can delete any event. | |
425 | .TP | |
426 | .B schedule-get \fIEVENT\fR | |
427 | Sends the details of scheduled event \fIEVENT\fR in a response body. | |
428 | Each line is a pair of strings quoted in the usual way, the first being the key | |
429 | ane the second the value. | |
430 | No particular order is used. | |
431 | .IP | |
432 | Scheduled events are considered public information. | |
433 | Right \fBread\fR is sufficient to see details of all events. | |
434 | .TP | |
435 | .B schedule-list | |
436 | Sends the event IDs of all scheduled events in a response body, in no | |
437 | particular order. | |
438 | Use \fBschedule-get\fR to get the details of each event. | |
439 | .TP | |
460b9539 | 440 | .B search \fITERMS\fR |
c0c23a60 RK |
441 | Search for tracks matching the search terms. |
442 | The results are put in a response body, one to a line. | |
460b9539 | 443 | .IP |
444 | The search string is split in the usual way, with quoting supported, into a | |
c0c23a60 RK |
445 | list of terms. |
446 | Only tracks matching all terms are included in the results. | |
460b9539 | 447 | .IP |
448 | Any terms of the form \fBtag:\fITAG\fR limits the search to tracks with that | |
449 | tag. | |
450 | .IP | |
451 | All other terms are interpreted as individual words which must be present in | |
452 | the track name. | |
453 | .IP | |
454 | Spaces in terms don't currently make sense, but may one day be interpreted to | |
455 | allow searching for phrases. | |
456 | .TP | |
457 | .B \fBset\fR \fITRACK\fR \fIPREF\fR \fIVALUE\fR | |
c0c23a60 RK |
458 | Set a preference. |
459 | Requires the \fBprefs\fR right. | |
460b9539 | 460 | .TP |
0d350ff0 | 461 | .B set\-global \fIKEY\fR \fIVALUE\fR |
c0c23a60 RK |
462 | Set a global preference. |
463 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 464 | .TP |
eea34c08 RK |
465 | .B shutdown |
466 | Requests server shutdown. | |
467 | Requires the \fBadmin\fR right. | |
468 | .TP | |
460b9539 | 469 | .B stats |
470 | Send server statistics in plain text in a response body. | |
471 | .TP | |
472 | .B \fBtags\fR | |
473 | Send the list of currently known tags in a response body. | |
474 | .TP | |
475 | .B \fBunset\fR \fITRACK\fR \fIPREF\fR | |
c0c23a60 RK |
476 | Unset a preference. |
477 | Requires the \fBprefs\fR right. | |
460b9539 | 478 | .TP |
0d350ff0 | 479 | .B \fBunset\-global\fR \fIKEY\fR |
c0c23a60 RK |
480 | Unset a global preference. |
481 | Requires the \fBglobal prefs\fR right. | |
460b9539 | 482 | .TP |
90ad6c6e RK |
483 | .B user \fIUSERNAME\fR \fIRESPONSE\fR |
484 | Authenticate as user \fIUSERNAME\fR. | |
c0c23a60 | 485 | See |
5e3f9e08 RK |
486 | .B AUTHENTICATION |
487 | below. | |
460b9539 | 488 | .TP |
90ad6c6e | 489 | .B userinfo \fIUSERNAME PROPERTY |
3e3566ad | 490 | Get a user property. |
b7de606b | 491 | See \fBUSER PROPERTIES\fR below. |
3e3566ad | 492 | .TP |
eb5dc014 | 493 | .B users |
5818980a | 494 | Send the list of currently known users in a response body. |
eb5dc014 | 495 | .TP |
460b9539 | 496 | .B version |
497 | Send back a response with the server version as the second field. | |
498 | .TP | |
499 | .B volume \fR[\fILEFT\fR [\fIRIGHT\fR]] | |
500 | Get or set the volume. | |
501 | .IP | |
502 | With zero parameters just gets the volume and reports the left and right sides | |
503 | as the 2nd and 3rd fields of the response. | |
504 | .IP | |
c0c23a60 RK |
505 | With one parameter sets both sides to the same value. |
506 | With two parameters sets each side independently. | |
507 | Setting the volume requires the \fBvolume\fR right. | |
460b9539 | 508 | .SH RESPONSES |
b7de606b RK |
509 | Response lines start with a three-digit status code followed by a space. |
510 | The meaning the response and the interpretation of the rest of the line depends | |
511 | on that code. | |
512 | .PP | |
c03fbc77 | 513 | The first digit distinguishes errors from successful responses: |
460b9539 | 514 | .TP |
515 | .B 2 | |
516 | Operation succeeded. | |
517 | .TP | |
518 | .B 5 | |
519 | Operation failed. | |
520 | .PP | |
521 | The second digit breaks down the origin of the response: | |
522 | .TP | |
523 | .B 0 | |
c0c23a60 | 524 | Generic responses not specific to the handling of the command. |
460b9539 | 525 | .TP |
b4a80f69 | 526 | .B 1 |
527 | 51x errors indicate that the user had insufficient rights for the command. | |
528 | .TP | |
460b9539 | 529 | .B 3 |
530 | Authentication responses. | |
531 | .TP | |
532 | .B 5 | |
533 | Responses specific to the handling of the command. | |
534 | .PP | |
535 | The third digit provides extra information about the response: | |
536 | .TP | |
537 | .B 0 | |
b7de606b | 538 | Text part is just commentary, intended to be human-readable. |
460b9539 | 539 | .TP |
540 | .B 1 | |
b7de606b RK |
541 | Text part is a constant result (e.g. \fBversion\fR). |
542 | It will not change on a subsequent use of the same command on the same | |
543 | conneciton. | |
460b9539 | 544 | .TP |
545 | .B 2 | |
546 | Text part is a potentially variable result. | |
547 | .TP | |
548 | .B 3 | |
549 | Text part is just commentary; a dot-stuffed body follows. | |
550 | .TP | |
551 | .B 4 | |
c0c23a60 RK |
552 | Text part is just commentary; an indefinite dot-stuffed body follows. |
553 | (Used for \fBlog\fR.) | |
460b9539 | 554 | .TP |
fb1bc1f5 | 555 | .B 5 |
b7de606b | 556 | Used with "harmless" errors, for instance a preference not being found. |
c0c23a60 | 557 | The text part is commentary. |
fb1bc1f5 | 558 | .TP |
460b9539 | 559 | .B 9 |
560 | The text part is just commentary (but would normally be a response for this | |
561 | command) e.g. \fBplaying\fR. | |
7b32e917 RK |
562 | .PP |
563 | Result strings (not bodies) intended for machine parsing (i.e. xx1 and xx2 | |
b7de606b | 564 | responses) are structure into fields in the the same way as command lines. |
460b9539 | 565 | .SH AUTHENTICATION |
5e3f9e08 | 566 | When a connection is made the server sends a \fB231\fR response before any |
c0c23a60 RK |
567 | command is received. |
568 | This contains a protocol generation, an algorithm name and a | |
b7de606b | 569 | challenge encoded in hex, in the fields of the response line. |
7b32e917 RK |
570 | .PP |
571 | The current protocol generation is \fB2\fR. | |
5e3f9e08 | 572 | .PP |
b3141726 | 573 | The possible algorithms are (currently) \fBsha1\fR, \fBsha256\fR, \fBsha384\fR |
c0c23a60 | 574 | and \fBsha512\fR. |
b7de606b | 575 | Completely upper-case names such as \fBSHA1\fR etc work as synonyms. |
460b9539 | 576 | .PP |
5e3f9e08 RK |
577 | The \fBuser\fR response consists of the selected hash of the user's password |
578 | concatenated with the challenge, encoded in hex. | |
460b9539 | 579 | .SH "TRACK INFORMATION" |
b7de606b | 580 | Track information is encoded in a response line as pairs of fields. |
c0c23a60 RK |
581 | The first is a name, the second a value. |
582 | The names have the following meanings: | |
460b9539 | 583 | .TP 12 |
584 | .B expected | |
585 | The time the track is expected to be played at. | |
586 | .TP | |
587 | .B id | |
588 | A string uniquely identifying this queue entry. | |
589 | .TP | |
590 | .B played | |
591 | The time the track was played at. | |
592 | .TP | |
593 | .B scratched | |
594 | The user that scratched the track. | |
595 | .TP | |
d42e98ca RK |
596 | .B origin |
597 | The origin of the track. Valid origins are: | |
598 | .RS | |
599 | .TP 12 | |
600 | .B adopted | |
601 | The track was originally randomly picked but has been adopted by a user. | |
602 | .TP | |
603 | .B picked | |
604 | The track was picked by a user. | |
605 | .TP | |
606 | .B random | |
607 | The track was randomly picked. | |
608 | .TP | |
609 | .B scheduled | |
610 | The track was played from a scheduled action. | |
611 | .TP | |
612 | .B scratch | |
613 | The track is a scratch sound. | |
614 | .RE | |
615 | .TP | |
460b9539 | 616 | .B state |
c0c23a60 RK |
617 | The current track state. |
618 | Valid states are: | |
460b9539 | 619 | .RS |
620 | .TP 12 | |
621 | .B failed | |
622 | The player failed (exited with nonzero status but wasn't scratched). | |
623 | .TP | |
460b9539 | 624 | .B ok |
625 | The track was played without any problems. | |
626 | .TP | |
627 | .B scratched | |
628 | The track was scratched. | |
629 | .TP | |
630 | .B started | |
631 | The track is currently playing. | |
632 | .TP | |
d42e98ca RK |
633 | .B paused |
634 | Track is playing but paused. | |
635 | .TP | |
460b9539 | 636 | .B unplayed |
637 | In the queue, hasn't been played yet. | |
638 | .TP | |
639 | .B quitting | |
640 | The track was terminated because the server is shutting down. | |
641 | .RE | |
642 | .TP | |
643 | .B submitter | |
644 | The user that submitted the track. | |
645 | .TP | |
646 | .B track | |
647 | The filename of the track. | |
648 | .TP | |
649 | .B when | |
650 | The time the track was added to the queue. | |
651 | .TP | |
652 | .B wstat | |
653 | The wait status of the player in decimal. | |
d42e98ca RK |
654 | .PP |
655 | Note that \fBorigin\fR is new with DisOrder 4.3, and obsoletes some old | |
656 | \fBstate\fR values. | |
460b9539 | 657 | .SH "EVENT LOG" |
658 | The event log consists of lines starting with a hexadecimal timestamp and a | |
b7de606b RK |
659 | keyword followed by (optionally) parameters, which are structured into fields |
660 | in the same way as command and response lines. | |
c0c23a60 | 661 | Currently the following keywords are used: |
460b9539 | 662 | .TP |
d42e98ca RK |
663 | .B adopted \fIID\fR \fIUSERNAME\fR |
664 | \fIUSERNAME\fR adopted track \fIID\fR. | |
665 | .TP | |
460b9539 | 666 | .B completed \fITRACK\fR |
667 | Completed playing \fITRACK\fR | |
668 | .TP | |
669 | .B failed \fITRACK\fR \fIERROR\fR | |
670 | Completed playing \fITRACK\fR with an error status | |
671 | .TP | |
f5f7150d RK |
672 | .B global_pref \fIPREF\fR [\fIVALUE\fR] |
673 | A global preference was set or unset. | |
674 | .TP | |
90ad6c6e RK |
675 | .B moved \fIUSERNAME\fR |
676 | User \fIUSERNAME\fR moved some track(s). | |
c0c23a60 | 677 | Further details aren't included any more. |
460b9539 | 678 | .TP |
90ad6c6e | 679 | .B playing \fITRACK\fR [\fIUSERNAME\fR] |
460b9539 | 680 | Started playing \fITRACK\fR. |
681 | .TP | |
5c102112 RK |
682 | .B playlist_created \fIPLAYLIST\fR \fISHARING\fR |
683 | Sent when a playlist is created. | |
684 | For private playlists this is intended to be sent only to the owner (but | |
685 | this is not currently implemented). | |
686 | .TP | |
687 | .B playlist_deleted \fIPLAYLIST\fR | |
688 | Sent when a playlist is deleted. | |
689 | For private playlists this is intended to be sent only to the owner (but | |
690 | this is not currently implemented). | |
691 | .TP | |
692 | .B playlist_modified \fIPLAYLIST\fR \fISHARING\fR | |
693 | Sent when a playlist is modified (either its contents or its sharing status). | |
694 | For private playlists this is intended to be sent only to the owner (but | |
695 | this is not currently implemented). | |
696 | .TP | |
460b9539 | 697 | .B queue \fIQUEUE-ENTRY\fR... |
698 | Added \fITRACK\fR to the queue. | |
699 | .TP | |
700 | .B recent_added \fIQUEUE-ENTRY\fR... | |
701 | Added \fIID\fR to the recently played list. | |
702 | .TP | |
703 | .B recent_removed \fIID\fR | |
704 | Removed \fIID\fR from the recently played list. | |
705 | .TP | |
90ad6c6e | 706 | .B removed \fIID\fR [\fIUSERNAME\fR] |
c0c23a60 | 707 | Queue entry \fIID\fR was removed. |
90ad6c6e | 708 | This is used both for explicit removal (when \fIUSERNAME\fR is present) |
c0c23a60 | 709 | and when playing a track (when it is absent). |
460b9539 | 710 | .TP |
e025abff RK |
711 | .B rescanned |
712 | A rescan completed. | |
713 | .TP | |
90ad6c6e RK |
714 | .B scratched \fITRACK\fR \fIUSERNAME\fR |
715 | \fITRACK\fR was scratched by \fIUSERNAME\fR. | |
460b9539 | 716 | .TP |
717 | .B state \fIKEYWORD\fR | |
c0c23a60 RK |
718 | Some state change occurred. |
719 | The current set of keywords is: | |
460b9539 | 720 | .RS |
721 | .TP | |
5abe307a RK |
722 | .B completed |
723 | The current track completed successfully. | |
724 | .TP | |
460b9539 | 725 | .B disable_play |
726 | Playing was disabled. | |
727 | .TP | |
728 | .B disable_random | |
729 | Random play was disabled. | |
730 | .TP | |
731 | .B enable_play | |
732 | Playing was enabled. | |
733 | .TP | |
734 | .B enable_random | |
735 | Random play was enabled. | |
736 | .TP | |
5abe307a RK |
737 | .B failed |
738 | The current track failed. | |
739 | .TP | |
460b9539 | 740 | .B pause |
741 | The current track was paused. | |
742 | .TP | |
5abe307a RK |
743 | .B playing |
744 | A track started playing. | |
745 | .TP | |
460b9539 | 746 | .B resume |
747 | The current track was resumed. | |
5abe307a | 748 | .TP |
75e7b7c3 | 749 | .B rights_changed \fIRIGHTS\fR |
ad492e00 RK |
750 | User's rights were changed. |
751 | .TP | |
5abe307a RK |
752 | .B scratched |
753 | The current track was scratched. | |
754 | .PP | |
755 | To simplify client implementation, \fBstate\fR commands reflecting the current | |
756 | state are sent at the start of the log. | |
460b9539 | 757 | .RE |
bb03d79d | 758 | .TP |
75e7b7c3 | 759 | .B user_add \fIUSERNAME\fR |
58d2aad2 RK |
760 | A user was created. |
761 | .TP | |
75e7b7c3 | 762 | .B user_delete \fIUSERNAME\fR |
58d2aad2 RK |
763 | A user was deleted. |
764 | .TP | |
75e7b7c3 | 765 | .B user_edit \fIUSERNAME\fR \fIPROPERTY\fR |
58d2aad2 RK |
766 | Some property of a user was edited. |
767 | .TP | |
75e7b7c3 | 768 | .B user_confirm \fIUSERNAME\fR |
58d2aad2 | 769 | A user's login was confirmed (via the web interface). |
460b9539 | 770 | .TP |
771 | .B volume \fILEFT\fR \fIRIGHT\fR | |
772 | The volume changed. | |
773 | .PP | |
774 | .IR QUEUE-ENTRY ... | |
775 | is as defined in | |
776 | .B "TRACK INFORMATION" | |
777 | above. | |
58d2aad2 RK |
778 | .PP |
779 | The \fBuser-*\fR messages are only sent to admin users, and are not sent over | |
780 | non-local connections unless \fBremote_userman\fR is enabled. | |
b7de606b RK |
781 | .SH "USER PROPERTIES" |
782 | The following user properties are defined: | |
f9635e06 | 783 | .TP |
b7de606b RK |
784 | .B created |
785 | The timestamp when the user was created. | |
786 | See \fBTIMESTAMPS\fR below. | |
787 | This user property cannot be modified. | |
788 | .TP | |
789 | .B email | |
790 | The user's email address. | |
791 | .TP | |
792 | .B password | |
793 | The user's password. | |
794 | .TP | |
795 | .B rights | |
796 | The rights the user has, separated by commas. | |
797 | .SH RIGHTS | |
798 | The full set of rights are: | |
799 | .TP | |
800 | .B read | |
801 | User can perform read-only operations | |
802 | .TP | |
803 | .B play | |
804 | User can add tracks to the queue | |
805 | .TP | |
806 | .B "move any" | |
807 | User can move any track | |
808 | .TP | |
809 | .B "move mine" | |
810 | User can move their own tracks | |
811 | .TP | |
812 | .B "move random" | |
813 | User can move randomly chosen tracks | |
814 | .TP | |
815 | .B "remove any" | |
816 | User can remove any track | |
817 | .TP | |
818 | .B "remove mine" | |
819 | User can remove their own tracks | |
820 | .TP | |
821 | .B "remove random" | |
822 | User can remove randomly chosen tracks | |
823 | .TP | |
824 | .B "scratch any" | |
825 | User can scratch any track | |
826 | .TP | |
827 | .B "scratch mine" | |
828 | User can scratch their own tracks | |
829 | .TP | |
830 | .B "scratch random" | |
831 | User can scratch randomly chosen tracks | |
832 | .TP | |
833 | .B volume | |
834 | User can change the volume | |
835 | .TP | |
836 | .B admin | |
837 | User can perform admin operations | |
838 | .TP | |
839 | .B rescan | |
840 | User can initiate a rescan | |
841 | .TP | |
842 | .B register | |
843 | User can register new users. | |
844 | Normally only the | |
845 | .B guest | |
846 | user would have this right. | |
847 | .TP | |
848 | .B userinfo | |
849 | User can edit their own userinfo | |
850 | .TP | |
851 | .B prefs | |
852 | User can modify track preferences | |
853 | .TP | |
854 | .B "global prefs" | |
855 | User can modify global preferences | |
856 | .TP | |
857 | .B pause | |
858 | User can pause/resume | |
859 | .SH TIMESTAMPS | |
860 | A \fItimestamp\fR is a decimal integer giving a number of seconds past the | |
861 | epoch, disregarding counting leap seconds. | |
862 | The epoch is midnight, January 1 1970, UTC. | |
863 | .SH NOTES | |
864 | For file listings, the regexp applies to the basename of the returned file, not | |
865 | the whole filename, and letter case is ignored. | |
866 | \fBpcrepattern\fR(3) describes the regexp syntax. | |
f9635e06 | 867 | .PP |
b7de606b RK |
868 | Filenames are in UTF-8 even if the collection they come from uses some other |
869 | encoding - if you want to access the real file (in such cases as the filenames | |
870 | actually correspond to a real file) you'll have to convert to whatever the | |
871 | right encoding is. | |
460b9539 | 872 | .SH "SEE ALSO" |
873 | \fBdisorder\fR(1), | |
874 | \fBtime\fR(2), | |
875 | \fBdisorder\fR(3), | |
876 | \fBpcrepattern\fR(3) | |
877 | \fBdisorder_config\fR(5), | |
878 | \fBdisorderd\fR(8), | |
879 | \fButf8\fR(7) | |
880 | .\" Local Variables: | |
881 | .\" mode:nroff | |
882 | .\" fill-column:79 | |
883 | .\" End: |