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) {
44 int rc = disorder_simple(c, &r, "confirm", confirmation, (char *)NULL);
47 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
49 disorder_error(0, "malformed reply to %s", "confirm");
56 int disorder_cookie(disorder_client *c, const char *cookie) {
59 int rc = disorder_simple(c, &r, "cookie", cookie, (char *)NULL);
62 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
64 disorder_error(0, "malformed reply to %s", "cookie");
71 int disorder_deluser(disorder_client *c, const char *user) {
72 return disorder_simple(c, NULL, "deluser", user, (char *)NULL);
75 int disorder_dirs(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp) {
76 int rc = disorder_simple(c, NULL, "dirs", dir, re, (char *)NULL);
79 if(readlist(c, filesp, nfilesp))
84 int disorder_disable(disorder_client *c) {
85 return disorder_simple(c, NULL, "disable", (char *)NULL);
88 int disorder_edituser(disorder_client *c, const char *username, const char *property, const char *value) {
89 return disorder_simple(c, NULL, "edituser", username, property, value, (char *)NULL);
92 int disorder_enable(disorder_client *c) {
93 return disorder_simple(c, NULL, "enable", (char *)NULL);
96 int disorder_enabled(disorder_client *c, int *enabledp) {
99 int rc = disorder_simple(c, &r, "enabled", (char *)NULL);
102 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
104 disorder_error(0, "malformed reply to %s", "enabled");
107 if(boolean("enabled", v[0], enabledp))
112 int disorder_exists(disorder_client *c, const char *track, int *existsp) {
115 int rc = disorder_simple(c, &r, "exists", track, (char *)NULL);
118 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
120 disorder_error(0, "malformed reply to %s", "exists");
123 if(boolean("exists", v[0], existsp))
128 int disorder_files(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp) {
129 int rc = disorder_simple(c, NULL, "files", dir, re, (char *)NULL);
132 if(readlist(c, filesp, nfilesp))
137 int disorder_get(disorder_client *c, const char *track, const char *pref, char **valuep) {
140 int rc = disorder_simple(c, &r, "get", track, pref, (char *)NULL);
143 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
145 disorder_error(0, "malformed reply to %s", "get");
152 int disorder_get_global(disorder_client *c, const char *pref, char **valuep) {
155 int rc = disorder_simple(c, &r, "get-global", pref, (char *)NULL);
158 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
160 disorder_error(0, "malformed reply to %s", "get-global");
167 int disorder_length(disorder_client *c, const char *track, long *lengthp) {
170 int rc = disorder_simple(c, &r, "length", track, (char *)NULL);
173 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
175 disorder_error(0, "malformed reply to %s", "length");
178 *lengthp = atol(v[0]);
182 int disorder_make_cookie(disorder_client *c, char **cookiep) {
185 int rc = disorder_simple(c, &r, "make-cookie", (char *)NULL);
188 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
190 disorder_error(0, "malformed reply to %s", "make-cookie");
197 int disorder_move(disorder_client *c, const char *track, long delta) {
199 byte_snprintf(buf_delta, sizeof buf_delta, "%ld", delta);
200 return disorder_simple(c, NULL, "move", track, buf_delta, (char *)NULL);
203 int disorder_moveafter(disorder_client *c, const char *target, char **ids, int nids) {
204 return disorder_simple(c, NULL, "moveafter", target, disorder_list, ids, nids, (char *)NULL);
207 int disorder_new_tracks(disorder_client *c, long max, char ***tracksp, int *ntracksp) {
209 byte_snprintf(buf_max, sizeof buf_max, "%ld", max);
210 int rc = disorder_simple(c, NULL, "new", buf_max, (char *)NULL);
213 if(readlist(c, tracksp, ntracksp))
218 int disorder_nop(disorder_client *c) {
219 return disorder_simple(c, NULL, "nop", (char *)NULL);
222 int disorder_part(disorder_client *c, const char *track, const char *context, const char *part, char **partp) {
225 int rc = disorder_simple(c, &r, "part", track, context, part, (char *)NULL);
228 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
230 disorder_error(0, "malformed reply to %s", "part");
237 int disorder_pause(disorder_client *c) {
238 return disorder_simple(c, NULL, "pause", (char *)NULL);
241 int disorder_play(disorder_client *c, const char *track, char **idp) {
242 return disorder_simple(c, idp, "play", track, (char *)NULL);
245 int disorder_playafter(disorder_client *c, const char *target, char **tracks, int ntracks) {
246 return disorder_simple(c, NULL, "playafter", target, disorder_list, tracks, ntracks, (char *)NULL);
249 int disorder_playing(disorder_client *c, struct queue_entry **playingp) {
250 return onequeue(c, "playing", playingp);
253 int disorder_playlist_delete(disorder_client *c, const char *playlist) {
254 return disorder_simple(c, NULL, "playlist-delete", playlist, (char *)NULL);
257 int disorder_playlist_get(disorder_client *c, const char *playlist, char ***tracksp, int *ntracksp) {
258 int rc = disorder_simple(c, NULL, "playlist-get", playlist, (char *)NULL);
261 if(readlist(c, tracksp, ntracksp))
266 int disorder_playlist_get_share(disorder_client *c, const char *playlist, char **sharep) {
267 return disorder_simple(c, sharep, "playlist-get-share", playlist, (char *)NULL);
270 int disorder_playlist_lock(disorder_client *c, const char *playlist) {
271 return disorder_simple(c, NULL, "playlist-lock", playlist, (char *)NULL);
274 int disorder_playlist_set(disorder_client *c, const char *playlist, char **tracks, int ntracks) {
275 return disorder_simple(c, NULL, "playlist-set", playlist, disorder_body, tracks, ntracks, (char *)NULL);
278 int disorder_playlist_set_share(disorder_client *c, const char *playlist, const char *share) {
279 return disorder_simple(c, NULL, "playlist-set-share", playlist, share, (char *)NULL);
282 int disorder_playlist_unlock(disorder_client *c) {
283 return disorder_simple(c, NULL, "playlist-unlock", (char *)NULL);
286 int disorder_playlists(disorder_client *c, char ***playlistsp, int *nplaylistsp) {
287 int rc = disorder_simple(c, NULL, "playlists", (char *)NULL);
290 if(readlist(c, playlistsp, nplaylistsp))
295 int disorder_prefs(disorder_client *c, const char *track, struct kvp **prefsp) {
296 return pairlist(c, prefsp, "prefs", track, (char *)NULL);
299 int disorder_queue(disorder_client *c, struct queue_entry **queuep) {
300 int rc = disorder_simple(c, NULL, "queue", (char *)NULL);
303 if(readqueue(c, queuep))
308 int disorder_random_disable(disorder_client *c) {
309 return disorder_simple(c, NULL, "random-disable", (char *)NULL);
312 int disorder_random_enable(disorder_client *c) {
313 return disorder_simple(c, NULL, "random-enable", (char *)NULL);
316 int disorder_random_enabled(disorder_client *c, int *enabledp) {
319 int rc = disorder_simple(c, &r, "random-enabled", (char *)NULL);
322 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
324 disorder_error(0, "malformed reply to %s", "random-enabled");
327 if(boolean("random-enabled", v[0], enabledp))
332 int disorder_recent(disorder_client *c, struct queue_entry **recentp) {
333 int rc = disorder_simple(c, NULL, "recent", (char *)NULL);
336 if(readqueue(c, recentp))
341 int disorder_reconfigure(disorder_client *c) {
342 return disorder_simple(c, NULL, "reconfigure", (char *)NULL);
345 int disorder_register(disorder_client *c, const char *username, const char *password, const char *email, char **confirmationp) {
348 int rc = disorder_simple(c, &r, "register", username, password, email, (char *)NULL);
351 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
353 disorder_error(0, "malformed reply to %s", "register");
356 *confirmationp = v[0];
360 int disorder_reminder(disorder_client *c, const char *username) {
361 return disorder_simple(c, NULL, "reminder", username, (char *)NULL);
364 int disorder_remove(disorder_client *c, const char *id) {
365 return disorder_simple(c, NULL, "remove", id, (char *)NULL);
368 int disorder_rescan(disorder_client *c) {
369 return disorder_simple(c, NULL, "rescan", (char *)NULL);
372 int disorder_resolve(disorder_client *c, const char *track, char **resolvedp) {
375 int rc = disorder_simple(c, &r, "resolve", track, (char *)NULL);
378 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
380 disorder_error(0, "malformed reply to %s", "resolve");
387 int disorder_resume(disorder_client *c) {
388 return disorder_simple(c, NULL, "resume", (char *)NULL);
391 int disorder_revoke(disorder_client *c) {
392 return disorder_simple(c, NULL, "revoke", (char *)NULL);
395 int disorder_rtp_address(disorder_client *c, char **addressp, char **portp) {
398 int rc = disorder_simple(c, &r, "rtp-address", (char *)NULL);
401 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
403 disorder_error(0, "malformed reply to %s", "rtp-address");
411 int disorder_scratch(disorder_client *c, const char *id) {
412 return disorder_simple(c, NULL, "scratch", id, (char *)NULL);
415 int disorder_schedule_add_play(disorder_client *c, time_t when, const char *priority, const char *track) {
417 byte_snprintf(buf_when, sizeof buf_when, "%lld", (long long)when);
418 return disorder_simple(c, NULL, "schedule-add", buf_when, priority, "play", track, (char *)NULL);
421 int disorder_schedule_add_set_global(disorder_client *c, time_t when, const char *priority, const char *pref, const char *value) {
423 byte_snprintf(buf_when, sizeof buf_when, "%lld", (long long)when);
424 return disorder_simple(c, NULL, "schedule-add", buf_when, priority, "set-global", pref, value, (char *)NULL);
427 int disorder_schedule_add_unset_global(disorder_client *c, time_t when, const char *priority, const char *pref) {
429 byte_snprintf(buf_when, sizeof buf_when, "%lld", (long long)when);
430 return disorder_simple(c, NULL, "schedule-add", buf_when, priority, "set-global", pref, (char *)NULL);
433 int disorder_schedule_del(disorder_client *c, const char *event) {
434 return disorder_simple(c, NULL, "schedule-del", event, (char *)NULL);
437 int disorder_schedule_get(disorder_client *c, const char *id, struct kvp **actiondatap) {
438 return pairlist(c, actiondatap, "schedule-get", id, (char *)NULL);
441 int disorder_schedule_list(disorder_client *c, char ***idsp, int *nidsp) {
442 int rc = disorder_simple(c, NULL, "schedule-list", (char *)NULL);
445 if(readlist(c, idsp, nidsp))
450 int disorder_search(disorder_client *c, const char *terms, char ***tracksp, int *ntracksp) {
451 int rc = disorder_simple(c, NULL, "search", terms, (char *)NULL);
454 if(readlist(c, tracksp, ntracksp))
459 int disorder_set(disorder_client *c, const char *track, const char *pref, const char *value) {
460 return disorder_simple(c, NULL, "set", track, pref, value, (char *)NULL);
463 int disorder_set_global(disorder_client *c, const char *pref, const char *value) {
464 return disorder_simple(c, NULL, "set-global", pref, value, (char *)NULL);
467 int disorder_shutdown(disorder_client *c) {
468 return disorder_simple(c, NULL, "shutdown", (char *)NULL);
471 int disorder_stats(disorder_client *c, char ***statsp, int *nstatsp) {
472 int rc = disorder_simple(c, NULL, "stats", (char *)NULL);
475 if(readlist(c, statsp, nstatsp))
480 int disorder_tags(disorder_client *c, char ***tagsp, int *ntagsp) {
481 int rc = disorder_simple(c, NULL, "tags", (char *)NULL);
484 if(readlist(c, tagsp, ntagsp))
489 int disorder_unset(disorder_client *c, const char *track, const char *pref) {
490 return disorder_simple(c, NULL, "unset", track, pref, (char *)NULL);
493 int disorder_unset_global(disorder_client *c, const char *pref) {
494 return disorder_simple(c, NULL, "unset-global", pref, (char *)NULL);
497 int disorder_userinfo(disorder_client *c, const char *username, const char *property, char **valuep) {
500 int rc = disorder_simple(c, &r, "userinfo", username, property, (char *)NULL);
503 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
505 disorder_error(0, "malformed reply to %s", "userinfo");
512 int disorder_users(disorder_client *c, char ***usersp, int *nusersp) {
513 int rc = disorder_simple(c, NULL, "users", (char *)NULL);
516 if(readlist(c, usersp, nusersp))
521 int disorder_version(disorder_client *c, char **versionp) {
524 int rc = disorder_simple(c, &r, "version", (char *)NULL);
527 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
529 disorder_error(0, "malformed reply to %s", "version");
536 int disorder_set_volume(disorder_client *c, long left, long right) {
538 byte_snprintf(buf_left, sizeof buf_left, "%ld", left);
540 byte_snprintf(buf_right, sizeof buf_right, "%ld", right);
541 return disorder_simple(c, NULL, "volume", buf_left, buf_right, (char *)NULL);
544 int disorder_get_volume(disorder_client *c, long *leftp, long *rightp) {
547 int rc = disorder_simple(c, &r, "volume", (char *)NULL);
550 v = split(r, &nv, SPLIT_QUOTES, 0, 0);
552 disorder_error(0, "malformed reply to %s", "volume");
556 *rightp = atol(v[1]);