Commit | Line | Data |
---|---|---|
ff75e16e RK |
1 | /* |
2 | * Automatically generated file, see scripts/protocol | |
3 | * | |
4 | * DO NOT EDIT. | |
5 | */ | |
7788b7c7 RK |
6 | /* |
7 | * This file is part of DisOrder. | |
ff75e16e | 8 | * Copyright (C) 2010-11 Richard Kettlewell |
7788b7c7 RK |
9 | * |
10 | * This program is free software: you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation, either version 3 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | */ | |
23 | #ifndef CLIENT_STUBS_H | |
24 | #define CLIENT_STUBS_H | |
d0f01ef6 RK |
25 | /** @file lib/client-stubs.h |
26 | * @brief Generated client API | |
27 | * | |
b0116b5c | 28 | * Don't include this file directly - use @ref lib/client.h instead. |
d0f01ef6 | 29 | */ |
7788b7c7 RK |
30 | |
31 | /** @brief Adopt a track | |
32 | * | |
33 | * Makes the calling user owner of a randomly picked track. | |
34 | * | |
08af2413 | 35 | * @param c Client |
7788b7c7 RK |
36 | * @param id Track ID |
37 | * @return 0 on success, non-0 on error | |
38 | */ | |
39 | int disorder_adopt(disorder_client *c, const char *id); | |
40 | ||
41 | /** @brief Create a user | |
42 | * | |
43 | * Create a new user. Requires the 'admin' right. Email addresses etc must be filled in in separate commands. | |
44 | * | |
08af2413 | 45 | * @param c Client |
7788b7c7 RK |
46 | * @param user New username |
47 | * @param password Initial password | |
48 | * @param rights Initial rights (optional) | |
49 | * @return 0 on success, non-0 on error | |
50 | */ | |
51 | int disorder_adduser(disorder_client *c, const char *user, const char *password, const char *rights); | |
52 | ||
3680ef53 RK |
53 | /** @brief List files and directories in a directory |
54 | * | |
55 | * See 'files' and 'dirs' for more specific lists. | |
56 | * | |
08af2413 | 57 | * @param c Client |
3680ef53 RK |
58 | * @param dir Directory to list (optional) |
59 | * @param re Regexp that results must match (optional) | |
60 | * @param filesp List of matching files and directories | |
61 | * @param nfilesp Number of elements in filesp | |
62 | * @return 0 on success, non-0 on error | |
63 | */ | |
64 | int disorder_allfiles(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp); | |
65 | ||
7788b7c7 RK |
66 | /** @brief Confirm registration |
67 | * | |
68 | * The confirmation string must have been created with 'register'. The username is returned so the caller knows who they are. | |
69 | * | |
f4522fa7 | 70 | * @param c Client |
7788b7c7 RK |
71 | * @param confirmation Confirmation string |
72 | * @return 0 on success, non-0 on error | |
73 | */ | |
74 | int disorder_confirm(disorder_client *c, const char *confirmation); | |
f4522fa7 | 75 | |
7788b7c7 RK |
76 | /** @brief Log in with a cookie |
77 | * | |
78 | * The cookie must have been created with 'make-cookie'. The username is returned so the caller knows who they are. | |
79 | * | |
f4522fa7 | 80 | * @param c Client |
7788b7c7 RK |
81 | * @param cookie Cookie string |
82 | * @return 0 on success, non-0 on error | |
83 | */ | |
84 | int disorder_cookie(disorder_client *c, const char *cookie); | |
f4522fa7 | 85 | |
7788b7c7 RK |
86 | /** @brief Delete user |
87 | * | |
88 | * Requires the 'admin' right. | |
89 | * | |
08af2413 | 90 | * @param c Client |
7788b7c7 RK |
91 | * @param user User to delete |
92 | * @return 0 on success, non-0 on error | |
93 | */ | |
94 | int disorder_deluser(disorder_client *c, const char *user); | |
95 | ||
3680ef53 RK |
96 | /** @brief List directories in a directory |
97 | * | |
98 | * | |
99 | * | |
08af2413 | 100 | * @param c Client |
3680ef53 RK |
101 | * @param dir Directory to list (optional) |
102 | * @param re Regexp that results must match (optional) | |
103 | * @param filesp List of matching directories | |
104 | * @param nfilesp Number of elements in filesp | |
105 | * @return 0 on success, non-0 on error | |
106 | */ | |
107 | int disorder_dirs(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp); | |
108 | ||
7788b7c7 RK |
109 | /** @brief Disable play |
110 | * | |
111 | * Play will stop at the end of the current track, if one is playing. Requires the 'global prefs' right. | |
112 | * | |
08af2413 | 113 | * @param c Client |
7788b7c7 RK |
114 | * @return 0 on success, non-0 on error |
115 | */ | |
116 | int disorder_disable(disorder_client *c); | |
117 | ||
118 | /** @brief Set a user property | |
119 | * | |
120 | * With the 'admin' right you can do anything. Otherwise you need the 'userinfo' right and can only set 'email' and 'password'. | |
121 | * | |
08af2413 | 122 | * @param c Client |
7788b7c7 RK |
123 | * @param username User to modify |
124 | * @param property Property name | |
125 | * @param value New property value | |
126 | * @return 0 on success, non-0 on error | |
127 | */ | |
128 | int disorder_edituser(disorder_client *c, const char *username, const char *property, const char *value); | |
129 | ||
130 | /** @brief Enable play | |
131 | * | |
132 | * Requires the 'global prefs' right. | |
133 | * | |
08af2413 | 134 | * @param c Client |
7788b7c7 RK |
135 | * @return 0 on success, non-0 on error |
136 | */ | |
137 | int disorder_enable(disorder_client *c); | |
138 | ||
139 | /** @brief Detect whether play is enabled | |
140 | * | |
141 | * | |
142 | * | |
08af2413 | 143 | * @param c Client |
7788b7c7 RK |
144 | * @param enabledp 1 if play is enabled and 0 otherwise |
145 | * @return 0 on success, non-0 on error | |
146 | */ | |
147 | int disorder_enabled(disorder_client *c, int *enabledp); | |
148 | ||
149 | /** @brief Test whether a track exists | |
150 | * | |
151 | * | |
152 | * | |
08af2413 | 153 | * @param c Client |
7788b7c7 RK |
154 | * @param track Track name |
155 | * @param existsp 1 if the track exists and 0 otherwise | |
156 | * @return 0 on success, non-0 on error | |
157 | */ | |
158 | int disorder_exists(disorder_client *c, const char *track, int *existsp); | |
159 | ||
3680ef53 RK |
160 | /** @brief List files in a directory |
161 | * | |
162 | * | |
163 | * | |
08af2413 | 164 | * @param c Client |
3680ef53 RK |
165 | * @param dir Directory to list (optional) |
166 | * @param re Regexp that results must match (optional) | |
167 | * @param filesp List of matching files | |
168 | * @param nfilesp Number of elements in filesp | |
169 | * @return 0 on success, non-0 on error | |
170 | */ | |
171 | int disorder_files(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp); | |
172 | ||
7788b7c7 RK |
173 | /** @brief Get a track preference |
174 | * | |
175 | * If the track does not exist that is an error. If the track exists but the preference does not then a null value is returned. | |
176 | * | |
08af2413 | 177 | * @param c Client |
7788b7c7 RK |
178 | * @param track Track name |
179 | * @param pref Preference name | |
180 | * @param valuep Preference value | |
181 | * @return 0 on success, non-0 on error | |
182 | */ | |
183 | int disorder_get(disorder_client *c, const char *track, const char *pref, char **valuep); | |
184 | ||
185 | /** @brief Get a global preference | |
186 | * | |
187 | * If the preference does exist not then a null value is returned. | |
188 | * | |
08af2413 | 189 | * @param c Client |
7788b7c7 RK |
190 | * @param pref Global preference name |
191 | * @param valuep Preference value | |
192 | * @return 0 on success, non-0 on error | |
193 | */ | |
194 | int disorder_get_global(disorder_client *c, const char *pref, char **valuep); | |
195 | ||
711a4497 RK |
196 | /** @brief Get a track's length |
197 | * | |
198 | * If the track does not exist an error is returned. | |
199 | * | |
08af2413 | 200 | * @param c Client |
711a4497 RK |
201 | * @param track Track name |
202 | * @param lengthp Track length in seconds | |
203 | * @return 0 on success, non-0 on error | |
204 | */ | |
205 | int disorder_length(disorder_client *c, const char *track, long *lengthp); | |
206 | ||
7788b7c7 RK |
207 | /** @brief Create a login cookie for this user |
208 | * | |
209 | * The cookie may be redeemed via the 'cookie' command | |
210 | * | |
08af2413 | 211 | * @param c Client |
7788b7c7 RK |
212 | * @param cookiep Newly created cookie |
213 | * @return 0 on success, non-0 on error | |
214 | */ | |
215 | int disorder_make_cookie(disorder_client *c, char **cookiep); | |
216 | ||
0bc1d67c RK |
217 | /** @brief Move a track |
218 | * | |
219 | * Requires one of the 'move mine', 'move random' or 'move any' rights depending on how the track came to be added to the queue. | |
220 | * | |
221 | * @param c Client | |
222 | * @param track Track ID or name | |
223 | * @param delta How far to move the track towards the head of the queue | |
224 | * @return 0 on success, non-0 on error | |
225 | */ | |
226 | int disorder_move(disorder_client *c, const char *track, long delta); | |
227 | ||
228 | /** @brief Move multiple tracks | |
229 | * | |
230 | * Requires one of the 'move mine', 'move random' or 'move any' rights depending on how the track came to be added to the queue. | |
231 | * | |
232 | * @param c Client | |
233 | * @param target Move after this track, or to head if "" | |
234 | * @param ids List of tracks to move by ID | |
235 | * @param nids Length of ids | |
236 | * @return 0 on success, non-0 on error | |
237 | */ | |
238 | int disorder_moveafter(disorder_client *c, const char *target, char **ids, int nids); | |
239 | ||
ff75e16e RK |
240 | /** @brief List recently added tracks |
241 | * | |
242 | * | |
243 | * | |
244 | * @param c Client | |
245 | * @param max Maximum tracks to fetch, or 0 for all available | |
246 | * @param tracksp Recently added tracks | |
247 | * @param ntracksp Number of elements in tracksp | |
248 | * @return 0 on success, non-0 on error | |
249 | */ | |
250 | int disorder_new_tracks(disorder_client *c, long max, char ***tracksp, int *ntracksp); | |
251 | ||
7788b7c7 RK |
252 | /** @brief Do nothing |
253 | * | |
254 | * Used as a keepalive. No authentication required. | |
255 | * | |
08af2413 | 256 | * @param c Client |
7788b7c7 RK |
257 | * @return 0 on success, non-0 on error |
258 | */ | |
259 | int disorder_nop(disorder_client *c); | |
260 | ||
261 | /** @brief Get a track name part | |
262 | * | |
263 | * If the name part cannot be constructed an empty string is returned. | |
264 | * | |
08af2413 | 265 | * @param c Client |
7788b7c7 RK |
266 | * @param track Track name |
267 | * @param context Context ("sort" or "display") | |
268 | * @param part Name part ("artist", "album" or "title") | |
269 | * @param partp Value of name part | |
270 | * @return 0 on success, non-0 on error | |
271 | */ | |
272 | int disorder_part(disorder_client *c, const char *track, const char *context, const char *part, char **partp); | |
273 | ||
274 | /** @brief Pause the currently playing track | |
275 | * | |
276 | * Requires the 'pause' right. | |
277 | * | |
08af2413 | 278 | * @param c Client |
7788b7c7 RK |
279 | * @return 0 on success, non-0 on error |
280 | */ | |
281 | int disorder_pause(disorder_client *c); | |
282 | ||
00861dcb RK |
283 | /** @brief Play a track |
284 | * | |
285 | * Requires the 'play' right. | |
286 | * | |
08af2413 | 287 | * @param c Client |
00861dcb RK |
288 | * @param track Track to play |
289 | * @param idp Queue ID of new track | |
290 | * @return 0 on success, non-0 on error | |
291 | */ | |
292 | int disorder_play(disorder_client *c, const char *track, char **idp); | |
293 | ||
0bc1d67c RK |
294 | /** @brief Play multiple tracks |
295 | * | |
296 | * Requires the 'play' right. | |
297 | * | |
298 | * @param c Client | |
299 | * @param target Insert into queue after this track, or at head if "" | |
300 | * @param tracks List of track names to play | |
301 | * @param ntracks Length of tracks | |
302 | * @return 0 on success, non-0 on error | |
303 | */ | |
304 | int disorder_playafter(disorder_client *c, const char *target, char **tracks, int ntracks); | |
305 | ||
ec9c0462 RK |
306 | /** @brief Retrieve the playing track |
307 | * | |
308 | * | |
309 | * | |
310 | * @param c Client | |
311 | * @param playingp Details of the playing track | |
312 | * @return 0 on success, non-0 on error | |
313 | */ | |
314 | int disorder_playing(disorder_client *c, struct queue_entry **playingp); | |
315 | ||
7788b7c7 RK |
316 | /** @brief Delete a playlist |
317 | * | |
318 | * Requires the 'play' right and permission to modify the playlist. | |
319 | * | |
08af2413 | 320 | * @param c Client |
7788b7c7 RK |
321 | * @param playlist Playlist to delete |
322 | * @return 0 on success, non-0 on error | |
323 | */ | |
324 | int disorder_playlist_delete(disorder_client *c, const char *playlist); | |
325 | ||
3680ef53 | 326 | /** @brief List the contents of a playlist |
7788b7c7 | 327 | * |
3680ef53 | 328 | * Requires the 'read' right and oermission to read the playlist. |
7788b7c7 | 329 | * |
08af2413 | 330 | * @param c Client |
3680ef53 RK |
331 | * @param playlist Playlist name |
332 | * @param tracksp List of tracks in playlist | |
333 | * @param ntracksp Number of elements in tracksp | |
7788b7c7 RK |
334 | * @return 0 on success, non-0 on error |
335 | */ | |
3680ef53 | 336 | int disorder_playlist_get(disorder_client *c, const char *playlist, char ***tracksp, int *ntracksp); |
7788b7c7 RK |
337 | |
338 | /** @brief Get a playlist's sharing status | |
339 | * | |
340 | * Requires the 'read' right and permission to read the playlist. | |
341 | * | |
08af2413 | 342 | * @param c Client |
7788b7c7 RK |
343 | * @param playlist Playlist to read |
344 | * @param sharep Sharing status ("public", "private" or "shared") | |
345 | * @return 0 on success, non-0 on error | |
346 | */ | |
347 | int disorder_playlist_get_share(disorder_client *c, const char *playlist, char **sharep); | |
348 | ||
3680ef53 RK |
349 | /** @brief Lock a playlist |
350 | * | |
351 | * Requires the 'play' right and permission to modify the playlist. A given connection may lock at most one playlist. | |
352 | * | |
08af2413 | 353 | * @param c Client |
3680ef53 RK |
354 | * @param playlist Playlist to delete |
355 | * @return 0 on success, non-0 on error | |
356 | */ | |
357 | int disorder_playlist_lock(disorder_client *c, const char *playlist); | |
358 | ||
08af2413 RK |
359 | /** @brief Set the contents of a playlist |
360 | * | |
361 | * Requires the 'play' right and permission to modify the playlist, which must be locked. | |
362 | * | |
363 | * @param c Client | |
364 | * @param playlist Playlist to modify | |
365 | * @param tracks New list of tracks for playlist | |
366 | * @param ntracks Length of tracks | |
367 | * @return 0 on success, non-0 on error | |
368 | */ | |
369 | int disorder_playlist_set(disorder_client *c, const char *playlist, char **tracks, int ntracks); | |
370 | ||
7788b7c7 RK |
371 | /** @brief Set a playlist's sharing status |
372 | * | |
373 | * Requires the 'play' right and permission to modify the playlist. | |
374 | * | |
08af2413 | 375 | * @param c Client |
7788b7c7 RK |
376 | * @param playlist Playlist to modify |
377 | * @param share New sharing status ("public", "private" or "shared") | |
378 | * @return 0 on success, non-0 on error | |
379 | */ | |
380 | int disorder_playlist_set_share(disorder_client *c, const char *playlist, const char *share); | |
381 | ||
382 | /** @brief Unlock the locked playlist playlist | |
383 | * | |
384 | * The playlist to unlock is implicit in the connection. | |
385 | * | |
08af2413 | 386 | * @param c Client |
7788b7c7 RK |
387 | * @return 0 on success, non-0 on error |
388 | */ | |
389 | int disorder_playlist_unlock(disorder_client *c); | |
390 | ||
3680ef53 RK |
391 | /** @brief List playlists |
392 | * | |
393 | * Requires the 'read' right. Only playlists that you have permission to read are returned. | |
394 | * | |
08af2413 | 395 | * @param c Client |
3680ef53 RK |
396 | * @param playlistsp Playlist names |
397 | * @param nplaylistsp Number of elements in playlistsp | |
398 | * @return 0 on success, non-0 on error | |
399 | */ | |
400 | int disorder_playlists(disorder_client *c, char ***playlistsp, int *nplaylistsp); | |
401 | ||
5dc19ffd RK |
402 | /** @brief Get all the preferences for a track |
403 | * | |
404 | * | |
405 | * | |
406 | * @param c Client | |
407 | * @param track Track name | |
408 | * @param prefsp Track preferences | |
409 | * @return 0 on success, non-0 on error | |
410 | */ | |
411 | int disorder_prefs(disorder_client *c, const char *track, struct kvp **prefsp); | |
412 | ||
08af2413 RK |
413 | /** @brief List the queue |
414 | * | |
415 | * | |
416 | * | |
417 | * @param c Client | |
418 | * @param queuep Current queue contents | |
419 | * @return 0 on success, non-0 on error | |
420 | */ | |
421 | int disorder_queue(disorder_client *c, struct queue_entry **queuep); | |
422 | ||
7788b7c7 RK |
423 | /** @brief Disable random play |
424 | * | |
425 | * Requires the 'global prefs' right. | |
426 | * | |
08af2413 | 427 | * @param c Client |
7788b7c7 RK |
428 | * @return 0 on success, non-0 on error |
429 | */ | |
430 | int disorder_random_disable(disorder_client *c); | |
431 | ||
432 | /** @brief Enable random play | |
433 | * | |
434 | * Requires the 'global prefs' right. | |
435 | * | |
08af2413 | 436 | * @param c Client |
7788b7c7 RK |
437 | * @return 0 on success, non-0 on error |
438 | */ | |
439 | int disorder_random_enable(disorder_client *c); | |
440 | ||
441 | /** @brief Detect whether random play is enabled | |
442 | * | |
443 | * Random play counts as enabled even if play is disabled. | |
444 | * | |
08af2413 | 445 | * @param c Client |
7788b7c7 RK |
446 | * @param enabledp 1 if random play is enabled and 0 otherwise |
447 | * @return 0 on success, non-0 on error | |
448 | */ | |
449 | int disorder_random_enabled(disorder_client *c, int *enabledp); | |
450 | ||
08af2413 RK |
451 | /** @brief List recently played tracks |
452 | * | |
453 | * | |
454 | * | |
455 | * @param c Client | |
456 | * @param recentp Recently played tracks | |
457 | * @return 0 on success, non-0 on error | |
458 | */ | |
459 | int disorder_recent(disorder_client *c, struct queue_entry **recentp); | |
460 | ||
7788b7c7 RK |
461 | /** @brief Re-read configuraiton file. |
462 | * | |
463 | * Requires the 'admin' right. | |
464 | * | |
08af2413 | 465 | * @param c Client |
7788b7c7 RK |
466 | * @return 0 on success, non-0 on error |
467 | */ | |
468 | int disorder_reconfigure(disorder_client *c); | |
469 | ||
470 | /** @brief Register a new user | |
471 | * | |
472 | * Requires the 'register' right which is usually only available to the 'guest' user. Redeem the confirmation string via 'confirm' to complete registration. | |
473 | * | |
08af2413 | 474 | * @param c Client |
7788b7c7 RK |
475 | * @param username Requested new username |
476 | * @param password Requested initial password | |
477 | * @param email New user's email address | |
478 | * @param confirmationp Confirmation string | |
479 | * @return 0 on success, non-0 on error | |
480 | */ | |
481 | int disorder_register(disorder_client *c, const char *username, const char *password, const char *email, char **confirmationp); | |
482 | ||
483 | /** @brief Send a password reminder. | |
484 | * | |
485 | * If the user has no valid email address, or no password, or a reminder has been sent too recently, then no reminder will be sent. | |
486 | * | |
08af2413 | 487 | * @param c Client |
7788b7c7 RK |
488 | * @param username User to remind |
489 | * @return 0 on success, non-0 on error | |
490 | */ | |
491 | int disorder_reminder(disorder_client *c, const char *username); | |
492 | ||
493 | /** @brief Remove a track form the queue. | |
494 | * | |
495 | * Requires one of the 'remove mine', 'remove random' or 'remove any' rights depending on how the track came to be added to the queue. | |
496 | * | |
08af2413 | 497 | * @param c Client |
7788b7c7 RK |
498 | * @param id Track ID |
499 | * @return 0 on success, non-0 on error | |
500 | */ | |
501 | int disorder_remove(disorder_client *c, const char *id); | |
502 | ||
503 | /** @brief Rescan all collections for new or obsolete tracks. | |
504 | * | |
505 | * Requires the 'rescan' right. | |
506 | * | |
08af2413 | 507 | * @param c Client |
7788b7c7 RK |
508 | * @return 0 on success, non-0 on error |
509 | */ | |
510 | int disorder_rescan(disorder_client *c); | |
511 | ||
512 | /** @brief Resolve a track name | |
513 | * | |
514 | * Converts aliases to non-alias track names | |
515 | * | |
08af2413 | 516 | * @param c Client |
7788b7c7 RK |
517 | * @param track Track name (might be an alias) |
518 | * @param resolvedp Resolve track name (definitely not an alias) | |
519 | * @return 0 on success, non-0 on error | |
520 | */ | |
521 | int disorder_resolve(disorder_client *c, const char *track, char **resolvedp); | |
522 | ||
523 | /** @brief Resume the currently playing track | |
524 | * | |
525 | * Requires the 'pause' right. | |
526 | * | |
08af2413 | 527 | * @param c Client |
7788b7c7 RK |
528 | * @return 0 on success, non-0 on error |
529 | */ | |
530 | int disorder_resume(disorder_client *c); | |
531 | ||
532 | /** @brief Revoke a cookie. | |
533 | * | |
534 | * It will not subsequently be possible to log in with the cookie. | |
535 | * | |
08af2413 | 536 | * @param c Client |
7788b7c7 RK |
537 | * @return 0 on success, non-0 on error |
538 | */ | |
539 | int disorder_revoke(disorder_client *c); | |
540 | ||
c12575c6 RK |
541 | /** @brief Get the server's RTP address information |
542 | * | |
543 | * | |
544 | * | |
545 | * @param c Client | |
546 | * @param addressp Where to store hostname or address | |
1f60835b | 547 | * @param portp Where to store service name or port number |
c12575c6 RK |
548 | * @return 0 on success, non-0 on error |
549 | */ | |
550 | int disorder_rtp_address(disorder_client *c, char **addressp, char **portp); | |
551 | ||
b0116b5c RK |
552 | /** @brief Cancel RTP stream |
553 | * | |
554 | * | |
555 | * | |
556 | * @param c Client | |
557 | * @return 0 on success, non-0 on error | |
558 | */ | |
559 | int disorder_rtp_cancel(disorder_client *c); | |
560 | ||
561 | /** @brief Request a unicast RTP stream | |
562 | * | |
563 | * | |
564 | * | |
565 | * @param c Client | |
566 | * @param address Destination address | |
567 | * @param port Destination port number | |
568 | * @return 0 on success, non-0 on error | |
569 | */ | |
570 | int disorder_rtp_request(disorder_client *c, const char *address, const char *port); | |
571 | ||
7788b7c7 RK |
572 | /** @brief Terminate the playing track. |
573 | * | |
574 | * Requires one of the 'scratch mine', 'scratch random' or 'scratch any' rights depending on how the track came to be added to the queue. | |
575 | * | |
08af2413 | 576 | * @param c Client |
7788b7c7 RK |
577 | * @param id Track ID (optional) |
578 | * @return 0 on success, non-0 on error | |
579 | */ | |
580 | int disorder_scratch(disorder_client *c, const char *id); | |
581 | ||
4d80373d RK |
582 | /** @brief Schedule a track to play in the future |
583 | * | |
584 | * | |
585 | * | |
586 | * @param c Client | |
587 | * @param when When to play the track | |
588 | * @param priority Event priority ("normal" or "junk") | |
589 | * @param track Track to play | |
590 | * @return 0 on success, non-0 on error | |
591 | */ | |
592 | int disorder_schedule_add_play(disorder_client *c, time_t when, const char *priority, const char *track); | |
593 | ||
594 | /** @brief Schedule a global setting to be changed in the future | |
595 | * | |
596 | * | |
597 | * | |
598 | * @param c Client | |
599 | * @param when When to change the setting | |
600 | * @param priority Event priority ("normal" or "junk") | |
601 | * @param pref Global preference to set | |
602 | * @param value New value of global preference | |
603 | * @return 0 on success, non-0 on error | |
604 | */ | |
605 | int disorder_schedule_add_set_global(disorder_client *c, time_t when, const char *priority, const char *pref, const char *value); | |
606 | ||
607 | /** @brief Schedule a global setting to be unset in the future | |
608 | * | |
609 | * | |
610 | * | |
611 | * @param c Client | |
612 | * @param when When to change the setting | |
613 | * @param priority Event priority ("normal" or "junk") | |
614 | * @param pref Global preference to set | |
615 | * @return 0 on success, non-0 on error | |
616 | */ | |
617 | int disorder_schedule_add_unset_global(disorder_client *c, time_t when, const char *priority, const char *pref); | |
618 | ||
7788b7c7 RK |
619 | /** @brief Delete a scheduled event. |
620 | * | |
621 | * Users can always delete their own scheduled events; with the admin right you can delete any event. | |
622 | * | |
08af2413 | 623 | * @param c Client |
7788b7c7 RK |
624 | * @param event ID of event to delete |
625 | * @return 0 on success, non-0 on error | |
626 | */ | |
627 | int disorder_schedule_del(disorder_client *c, const char *event); | |
628 | ||
5dc19ffd RK |
629 | /** @brief Get the details of scheduled event |
630 | * | |
631 | * | |
632 | * | |
633 | * @param c Client | |
634 | * @param id Event ID | |
635 | * @param actiondatap Details of event | |
636 | * @return 0 on success, non-0 on error | |
637 | */ | |
638 | int disorder_schedule_get(disorder_client *c, const char *id, struct kvp **actiondatap); | |
639 | ||
3680ef53 RK |
640 | /** @brief List scheduled events |
641 | * | |
642 | * This just lists IDs. Use 'schedule-get' to retrieve more detail | |
643 | * | |
08af2413 | 644 | * @param c Client |
3680ef53 RK |
645 | * @param idsp List of event IDs |
646 | * @param nidsp Number of elements in idsp | |
647 | * @return 0 on success, non-0 on error | |
648 | */ | |
649 | int disorder_schedule_list(disorder_client *c, char ***idsp, int *nidsp); | |
650 | ||
651 | /** @brief Search for tracks | |
652 | * | |
653 | * Terms are either keywords or tags formatted as 'tag:TAG-NAME'. | |
654 | * | |
08af2413 | 655 | * @param c Client |
3680ef53 RK |
656 | * @param terms List of search terms |
657 | * @param tracksp List of matching tracks | |
658 | * @param ntracksp Number of elements in tracksp | |
659 | * @return 0 on success, non-0 on error | |
660 | */ | |
661 | int disorder_search(disorder_client *c, const char *terms, char ***tracksp, int *ntracksp); | |
662 | ||
7788b7c7 RK |
663 | /** @brief Set a track preference |
664 | * | |
665 | * Requires the 'prefs' right. | |
666 | * | |
08af2413 | 667 | * @param c Client |
7788b7c7 RK |
668 | * @param track Track name |
669 | * @param pref Preference name | |
670 | * @param value New value | |
671 | * @return 0 on success, non-0 on error | |
672 | */ | |
673 | int disorder_set(disorder_client *c, const char *track, const char *pref, const char *value); | |
674 | ||
675 | /** @brief Set a global preference | |
676 | * | |
677 | * Requires the 'global prefs' right. | |
678 | * | |
08af2413 | 679 | * @param c Client |
7788b7c7 RK |
680 | * @param pref Preference name |
681 | * @param value New value | |
682 | * @return 0 on success, non-0 on error | |
683 | */ | |
684 | int disorder_set_global(disorder_client *c, const char *pref, const char *value); | |
685 | ||
eea34c08 RK |
686 | /** @brief Request server shutdown |
687 | * | |
688 | * Requires the 'admin' right. | |
689 | * | |
08af2413 | 690 | * @param c Client |
eea34c08 RK |
691 | * @return 0 on success, non-0 on error |
692 | */ | |
693 | int disorder_shutdown(disorder_client *c); | |
694 | ||
3680ef53 RK |
695 | /** @brief Get server statistics |
696 | * | |
c12575c6 | 697 | * The details of what the server reports are not really defined. The returned strings are intended to be printed out one to a line. |
3680ef53 | 698 | * |
08af2413 | 699 | * @param c Client |
3680ef53 RK |
700 | * @param statsp List of server information strings. |
701 | * @param nstatsp Number of elements in statsp | |
702 | * @return 0 on success, non-0 on error | |
703 | */ | |
704 | int disorder_stats(disorder_client *c, char ***statsp, int *nstatsp); | |
705 | ||
706 | /** @brief Get a list of known tags | |
707 | * | |
708 | * Only tags which apply to at least one track are returned. | |
709 | * | |
08af2413 | 710 | * @param c Client |
3680ef53 RK |
711 | * @param tagsp List of tags |
712 | * @param ntagsp Number of elements in tagsp | |
713 | * @return 0 on success, non-0 on error | |
714 | */ | |
715 | int disorder_tags(disorder_client *c, char ***tagsp, int *ntagsp); | |
716 | ||
7788b7c7 RK |
717 | /** @brief Unset a track preference |
718 | * | |
719 | * Requires the 'prefs' right. | |
720 | * | |
08af2413 | 721 | * @param c Client |
7788b7c7 RK |
722 | * @param track Track name |
723 | * @param pref Preference name | |
724 | * @return 0 on success, non-0 on error | |
725 | */ | |
726 | int disorder_unset(disorder_client *c, const char *track, const char *pref); | |
727 | ||
728 | /** @brief Set a global preference | |
729 | * | |
730 | * Requires the 'global prefs' right. | |
731 | * | |
08af2413 | 732 | * @param c Client |
7788b7c7 RK |
733 | * @param pref Preference name |
734 | * @return 0 on success, non-0 on error | |
735 | */ | |
736 | int disorder_unset_global(disorder_client *c, const char *pref); | |
737 | ||
738 | /** @brief Get a user property. | |
739 | * | |
740 | * If the user does not exist an error is returned, if the user exists but the property does not then a null value is returned. | |
741 | * | |
08af2413 | 742 | * @param c Client |
7788b7c7 RK |
743 | * @param username User to read |
744 | * @param property Property to read | |
745 | * @param valuep Value of property | |
746 | * @return 0 on success, non-0 on error | |
747 | */ | |
748 | int disorder_userinfo(disorder_client *c, const char *username, const char *property, char **valuep); | |
749 | ||
3680ef53 RK |
750 | /** @brief Get a list of users |
751 | * | |
752 | * | |
753 | * | |
08af2413 | 754 | * @param c Client |
3680ef53 RK |
755 | * @param usersp List of users |
756 | * @param nusersp Number of elements in usersp | |
757 | * @return 0 on success, non-0 on error | |
758 | */ | |
759 | int disorder_users(disorder_client *c, char ***usersp, int *nusersp); | |
760 | ||
7788b7c7 RK |
761 | /** @brief Get the server version |
762 | * | |
763 | * | |
764 | * | |
08af2413 | 765 | * @param c Client |
7788b7c7 RK |
766 | * @param versionp Server version string |
767 | * @return 0 on success, non-0 on error | |
768 | */ | |
769 | int disorder_version(disorder_client *c, char **versionp); | |
770 | ||
c12575c6 RK |
771 | /** @brief Set the volume |
772 | * | |
773 | * | |
774 | * | |
775 | * @param c Client | |
776 | * @param left Left channel volume | |
777 | * @param right Right channel volume | |
778 | * @return 0 on success, non-0 on error | |
779 | */ | |
780 | int disorder_set_volume(disorder_client *c, long left, long right); | |
781 | ||
782 | /** @brief Get the volume | |
783 | * | |
784 | * | |
785 | * | |
786 | * @param c Client | |
787 | * @param leftp Left channel volume | |
1f60835b | 788 | * @param rightp Right channel volume |
c12575c6 RK |
789 | * @return 0 on success, non-0 on error |
790 | */ | |
791 | int disorder_get_volume(disorder_client *c, long *leftp, long *rightp); | |
792 | ||
7788b7c7 | 793 | #endif |