2 * Automatically generated file, see scripts/protocol
7 * This file is part of DisOrder.
8 * Copyright (C) 2010-11 Richard Kettlewell
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.
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.
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/>.
24 int disorder_adopt(disorder_client
*c
, const char *id
) {
25 return disorder_simple(c
, NULL
, "adopt", id
, (char *)NULL
);
28 int disorder_adduser(disorder_client
*c
, const char *user
, const char *password
, const char *rights
) {
29 return disorder_simple(c
, NULL
, "adduser", user
, password
, rights
, (char *)NULL
);
32 int disorder_allfiles(disorder_client
*c
, const char *dir
, const char *re
, char ***filesp
, int *nfilesp
) {
33 int rc
= disorder_simple(c
, NULL
, "allfiles", dir
, re
, (char *)NULL
);
36 if(readlist(c
, filesp
, nfilesp
))
41 int disorder_confirm(disorder_client
*c
, const char *confirmation
) {
43 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "confirm", confirmation
, (char *)NULL
);
52 int disorder_cookie(disorder_client
*c
, const char *cookie
) {
54 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "cookie", cookie
, (char *)NULL
);
63 int disorder_deluser(disorder_client
*c
, const char *user
) {
64 return disorder_simple(c
, NULL
, "deluser", user
, (char *)NULL
);
67 int disorder_dirs(disorder_client
*c
, const char *dir
, const char *re
, char ***filesp
, int *nfilesp
) {
68 int rc
= disorder_simple(c
, NULL
, "dirs", dir
, re
, (char *)NULL
);
71 if(readlist(c
, filesp
, nfilesp
))
76 int disorder_disable(disorder_client
*c
) {
77 return disorder_simple(c
, NULL
, "disable", (char *)NULL
);
80 int disorder_edituser(disorder_client
*c
, const char *username
, const char *property
, const char *value
) {
81 return disorder_simple(c
, NULL
, "edituser", username
, property
, value
, (char *)NULL
);
84 int disorder_enable(disorder_client
*c
) {
85 return disorder_simple(c
, NULL
, "enable", (char *)NULL
);
88 int disorder_enabled(disorder_client
*c
, int *enabledp
) {
90 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "enabled", (char *)NULL
);
93 if(boolean("enabled", v
[0], enabledp
))
99 int disorder_exists(disorder_client
*c
, const char *track
, int *existsp
) {
101 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "exists", track
, (char *)NULL
);
104 if(boolean("exists", v
[0], existsp
))
110 int disorder_files(disorder_client
*c
, const char *dir
, const char *re
, char ***filesp
, int *nfilesp
) {
111 int rc
= disorder_simple(c
, NULL
, "files", dir
, re
, (char *)NULL
);
114 if(readlist(c
, filesp
, nfilesp
))
119 int disorder_get(disorder_client
*c
, const char *track
, const char *pref
, char **valuep
) {
121 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "get", track
, pref
, (char *)NULL
);
130 int disorder_get_global(disorder_client
*c
, const char *pref
, char **valuep
) {
132 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "get-global", pref
, (char *)NULL
);
141 int disorder_length(disorder_client
*c
, const char *track
, long *lengthp
) {
143 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "length", track
, (char *)NULL
);
146 *lengthp
= atol(v
[0]);
151 int disorder_make_cookie(disorder_client
*c
, char **cookiep
) {
153 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "make-cookie", (char *)NULL
);
162 int disorder_move(disorder_client
*c
, const char *track
, long delta
) {
164 byte_snprintf(buf_delta
, sizeof buf_delta
, "%ld", delta
);
165 return disorder_simple(c
, NULL
, "move", track
, buf_delta
, (char *)NULL
);
168 int disorder_moveafter(disorder_client
*c
, const char *target
, char **ids
, int nids
) {
169 return disorder_simple(c
, NULL
, "moveafter", target
, disorder__list
, ids
, nids
, (char *)NULL
);
172 int disorder_new_tracks(disorder_client
*c
, long max
, char ***tracksp
, int *ntracksp
) {
174 byte_snprintf(buf_max
, sizeof buf_max
, "%ld", max
);
175 int rc
= disorder_simple(c
, NULL
, "new", buf_max
, (char *)NULL
);
178 if(readlist(c
, tracksp
, ntracksp
))
183 int disorder_nop(disorder_client
*c
) {
184 return disorder_simple(c
, NULL
, "nop", (char *)NULL
);
187 int disorder_part(disorder_client
*c
, const char *track
, const char *context
, const char *part
, char **partp
) {
189 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "part", track
, context
, part
, (char *)NULL
);
198 int disorder_pause(disorder_client
*c
) {
199 return disorder_simple(c
, NULL
, "pause", (char *)NULL
);
202 int disorder_play(disorder_client
*c
, const char *track
, char **idp
) {
203 return disorder_simple(c
, idp
, "play", track
, (char *)NULL
);
206 int disorder_playafter(disorder_client
*c
, const char *target
, char **tracks
, int ntracks
) {
207 return disorder_simple(c
, NULL
, "playafter", target
, disorder__list
, tracks
, ntracks
, (char *)NULL
);
210 int disorder_playing(disorder_client
*c
, struct queue_entry
**playingp
) {
211 return onequeue(c
, "playing", playingp
);
214 int disorder_playlist_delete(disorder_client
*c
, const char *playlist
) {
215 return disorder_simple(c
, NULL
, "playlist-delete", playlist
, (char *)NULL
);
218 int disorder_playlist_get(disorder_client
*c
, const char *playlist
, char ***tracksp
, int *ntracksp
) {
219 int rc
= disorder_simple(c
, NULL
, "playlist-get", playlist
, (char *)NULL
);
222 if(readlist(c
, tracksp
, ntracksp
))
227 int disorder_playlist_get_share(disorder_client
*c
, const char *playlist
, char **sharep
) {
228 return disorder_simple(c
, sharep
, "playlist-get-share", playlist
, (char *)NULL
);
231 int disorder_playlist_lock(disorder_client
*c
, const char *playlist
) {
232 return disorder_simple(c
, NULL
, "playlist-lock", playlist
, (char *)NULL
);
235 int disorder_playlist_set(disorder_client
*c
, const char *playlist
, char **tracks
, int ntracks
) {
236 return disorder_simple(c
, NULL
, "playlist-set", playlist
, disorder__body
, tracks
, ntracks
, (char *)NULL
);
239 int disorder_playlist_set_share(disorder_client
*c
, const char *playlist
, const char *share
) {
240 return disorder_simple(c
, NULL
, "playlist-set-share", playlist
, share
, (char *)NULL
);
243 int disorder_playlist_unlock(disorder_client
*c
) {
244 return disorder_simple(c
, NULL
, "playlist-unlock", (char *)NULL
);
247 int disorder_playlists(disorder_client
*c
, char ***playlistsp
, int *nplaylistsp
) {
248 int rc
= disorder_simple(c
, NULL
, "playlists", (char *)NULL
);
251 if(readlist(c
, playlistsp
, nplaylistsp
))
256 int disorder_prefs(disorder_client
*c
, const char *track
, struct kvp
**prefsp
) {
257 return pairlist(c
, prefsp
, "prefs", track
, (char *)NULL
);
260 int disorder_queue(disorder_client
*c
, struct queue_entry
**queuep
) {
261 int rc
= disorder_simple(c
, NULL
, "queue", (char *)NULL
);
264 if(readqueue(c
, queuep
))
269 int disorder_random_disable(disorder_client
*c
) {
270 return disorder_simple(c
, NULL
, "random-disable", (char *)NULL
);
273 int disorder_random_enable(disorder_client
*c
) {
274 return disorder_simple(c
, NULL
, "random-enable", (char *)NULL
);
277 int disorder_random_enabled(disorder_client
*c
, int *enabledp
) {
279 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "random-enabled", (char *)NULL
);
282 if(boolean("random-enabled", v
[0], enabledp
))
288 int disorder_recent(disorder_client
*c
, struct queue_entry
**recentp
) {
289 int rc
= disorder_simple(c
, NULL
, "recent", (char *)NULL
);
292 if(readqueue(c
, recentp
))
297 int disorder_reconfigure(disorder_client
*c
) {
298 return disorder_simple(c
, NULL
, "reconfigure", (char *)NULL
);
301 int disorder_register(disorder_client
*c
, const char *username
, const char *password
, const char *email
, char **confirmationp
) {
303 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "register", username
, password
, email
, (char *)NULL
);
306 *confirmationp
= v
[0];
312 int disorder_reminder(disorder_client
*c
, const char *username
) {
313 return disorder_simple(c
, NULL
, "reminder", username
, (char *)NULL
);
316 int disorder_remove(disorder_client
*c
, const char *id
) {
317 return disorder_simple(c
, NULL
, "remove", id
, (char *)NULL
);
320 int disorder_rescan(disorder_client
*c
) {
321 return disorder_simple(c
, NULL
, "rescan", (char *)NULL
);
324 int disorder_resolve(disorder_client
*c
, const char *track
, char **resolvedp
) {
326 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "resolve", track
, (char *)NULL
);
335 int disorder_resume(disorder_client
*c
) {
336 return disorder_simple(c
, NULL
, "resume", (char *)NULL
);
339 int disorder_revoke(disorder_client
*c
) {
340 return disorder_simple(c
, NULL
, "revoke", (char *)NULL
);
343 int disorder_rtp_address(disorder_client
*c
, char **addressp
, char **portp
) {
345 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 2, "rtp-address", (char *)NULL
);
356 int disorder_scratch(disorder_client
*c
, const char *id
) {
357 return disorder_simple(c
, NULL
, "scratch", id
, (char *)NULL
);
360 int disorder_schedule_add_play(disorder_client
*c
, time_t when
, const char *priority
, const char *track
) {
362 byte_snprintf(buf_when
, sizeof buf_when
, "%lld", (long long)when
);
363 return disorder_simple(c
, NULL
, "schedule-add", buf_when
, priority
, "play", track
, (char *)NULL
);
366 int disorder_schedule_add_set_global(disorder_client
*c
, time_t when
, const char *priority
, const char *pref
, const char *value
) {
368 byte_snprintf(buf_when
, sizeof buf_when
, "%lld", (long long)when
);
369 return disorder_simple(c
, NULL
, "schedule-add", buf_when
, priority
, "set-global", pref
, value
, (char *)NULL
);
372 int disorder_schedule_add_unset_global(disorder_client
*c
, time_t when
, const char *priority
, const char *pref
) {
374 byte_snprintf(buf_when
, sizeof buf_when
, "%lld", (long long)when
);
375 return disorder_simple(c
, NULL
, "schedule-add", buf_when
, priority
, "set-global", pref
, (char *)NULL
);
378 int disorder_schedule_del(disorder_client
*c
, const char *event
) {
379 return disorder_simple(c
, NULL
, "schedule-del", event
, (char *)NULL
);
382 int disorder_schedule_get(disorder_client
*c
, const char *id
, struct kvp
**actiondatap
) {
383 return pairlist(c
, actiondatap
, "schedule-get", id
, (char *)NULL
);
386 int disorder_schedule_list(disorder_client
*c
, char ***idsp
, int *nidsp
) {
387 int rc
= disorder_simple(c
, NULL
, "schedule-list", (char *)NULL
);
390 if(readlist(c
, idsp
, nidsp
))
395 int disorder_search(disorder_client
*c
, const char *terms
, char ***tracksp
, int *ntracksp
) {
396 int rc
= disorder_simple(c
, NULL
, "search", terms
, (char *)NULL
);
399 if(readlist(c
, tracksp
, ntracksp
))
404 int disorder_set(disorder_client
*c
, const char *track
, const char *pref
, const char *value
) {
405 return disorder_simple(c
, NULL
, "set", track
, pref
, value
, (char *)NULL
);
408 int disorder_set_global(disorder_client
*c
, const char *pref
, const char *value
) {
409 return disorder_simple(c
, NULL
, "set-global", pref
, value
, (char *)NULL
);
412 int disorder_shutdown(disorder_client
*c
) {
413 return disorder_simple(c
, NULL
, "shutdown", (char *)NULL
);
416 int disorder_stats(disorder_client
*c
, char ***statsp
, int *nstatsp
) {
417 int rc
= disorder_simple(c
, NULL
, "stats", (char *)NULL
);
420 if(readlist(c
, statsp
, nstatsp
))
425 int disorder_tags(disorder_client
*c
, char ***tagsp
, int *ntagsp
) {
426 int rc
= disorder_simple(c
, NULL
, "tags", (char *)NULL
);
429 if(readlist(c
, tagsp
, ntagsp
))
434 int disorder_unset(disorder_client
*c
, const char *track
, const char *pref
) {
435 return disorder_simple(c
, NULL
, "unset", track
, pref
, (char *)NULL
);
438 int disorder_unset_global(disorder_client
*c
, const char *pref
) {
439 return disorder_simple(c
, NULL
, "unset-global", pref
, (char *)NULL
);
442 int disorder_userinfo(disorder_client
*c
, const char *username
, const char *property
, char **valuep
) {
444 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "userinfo", username
, property
, (char *)NULL
);
453 int disorder_users(disorder_client
*c
, char ***usersp
, int *nusersp
) {
454 int rc
= disorder_simple(c
, NULL
, "users", (char *)NULL
);
457 if(readlist(c
, usersp
, nusersp
))
462 int disorder_version(disorder_client
*c
, char **versionp
) {
464 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "version", (char *)NULL
);
473 int disorder_set_volume(disorder_client
*c
, long left
, long right
) {
475 byte_snprintf(buf_left
, sizeof buf_left
, "%ld", left
);
477 byte_snprintf(buf_right
, sizeof buf_right
, "%ld", right
);
478 return disorder_simple(c
, NULL
, "volume", buf_left
, buf_right
, (char *)NULL
);
481 int disorder_get_volume(disorder_client
*c
, long *leftp
, long *rightp
) {
483 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 2, "volume", (char *)NULL
);
487 *rightp
= atol(v
[1]);