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
);
50 int disorder_cookie(disorder_client
*c
, const char *cookie
) {
52 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "cookie", cookie
, (char *)NULL
);
59 int disorder_deluser(disorder_client
*c
, const char *user
) {
60 return disorder_simple(c
, NULL
, "deluser", user
, (char *)NULL
);
63 int disorder_dirs(disorder_client
*c
, const char *dir
, const char *re
, char ***filesp
, int *nfilesp
) {
64 int rc
= disorder_simple(c
, NULL
, "dirs", dir
, re
, (char *)NULL
);
67 if(readlist(c
, filesp
, nfilesp
))
72 int disorder_disable(disorder_client
*c
) {
73 return disorder_simple(c
, NULL
, "disable", (char *)NULL
);
76 int disorder_edituser(disorder_client
*c
, const char *username
, const char *property
, const char *value
) {
77 return disorder_simple(c
, NULL
, "edituser", username
, property
, value
, (char *)NULL
);
80 int disorder_enable(disorder_client
*c
) {
81 return disorder_simple(c
, NULL
, "enable", (char *)NULL
);
84 int disorder_enabled(disorder_client
*c
, int *enabledp
) {
86 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "enabled", (char *)NULL
);
89 if(boolean("enabled", v
[0], enabledp
))
94 int disorder_exists(disorder_client
*c
, const char *track
, int *existsp
) {
96 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "exists", track
, (char *)NULL
);
99 if(boolean("exists", v
[0], existsp
))
104 int disorder_files(disorder_client
*c
, const char *dir
, const char *re
, char ***filesp
, int *nfilesp
) {
105 int rc
= disorder_simple(c
, NULL
, "files", dir
, re
, (char *)NULL
);
108 if(readlist(c
, filesp
, nfilesp
))
113 int disorder_get(disorder_client
*c
, const char *track
, const char *pref
, char **valuep
) {
115 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "get", track
, pref
, (char *)NULL
);
122 int disorder_get_global(disorder_client
*c
, const char *pref
, char **valuep
) {
124 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "get-global", pref
, (char *)NULL
);
131 int disorder_length(disorder_client
*c
, const char *track
, long *lengthp
) {
133 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "length", track
, (char *)NULL
);
136 *lengthp
= atol(v
[0]);
140 int disorder_make_cookie(disorder_client
*c
, char **cookiep
) {
142 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "make-cookie", (char *)NULL
);
149 int disorder_move(disorder_client
*c
, const char *track
, long delta
) {
151 byte_snprintf(buf_delta
, sizeof buf_delta
, "%ld", delta
);
152 return disorder_simple(c
, NULL
, "move", track
, buf_delta
, (char *)NULL
);
155 int disorder_moveafter(disorder_client
*c
, const char *target
, char **ids
, int nids
) {
156 return disorder_simple(c
, NULL
, "moveafter", target
, disorder_list
, ids
, nids
, (char *)NULL
);
159 int disorder_new_tracks(disorder_client
*c
, long max
, char ***tracksp
, int *ntracksp
) {
161 byte_snprintf(buf_max
, sizeof buf_max
, "%ld", max
);
162 int rc
= disorder_simple(c
, NULL
, "new", buf_max
, (char *)NULL
);
165 if(readlist(c
, tracksp
, ntracksp
))
170 int disorder_nop(disorder_client
*c
) {
171 return disorder_simple(c
, NULL
, "nop", (char *)NULL
);
174 int disorder_part(disorder_client
*c
, const char *track
, const char *context
, const char *part
, char **partp
) {
176 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "part", track
, context
, part
, (char *)NULL
);
183 int disorder_pause(disorder_client
*c
) {
184 return disorder_simple(c
, NULL
, "pause", (char *)NULL
);
187 int disorder_play(disorder_client
*c
, const char *track
, char **idp
) {
188 return disorder_simple(c
, idp
, "play", track
, (char *)NULL
);
191 int disorder_playafter(disorder_client
*c
, const char *target
, char **tracks
, int ntracks
) {
192 return disorder_simple(c
, NULL
, "playafter", target
, disorder_list
, tracks
, ntracks
, (char *)NULL
);
195 int disorder_playing(disorder_client
*c
, struct queue_entry
**playingp
) {
196 return onequeue(c
, "playing", playingp
);
199 int disorder_playlist_delete(disorder_client
*c
, const char *playlist
) {
200 return disorder_simple(c
, NULL
, "playlist-delete", playlist
, (char *)NULL
);
203 int disorder_playlist_get(disorder_client
*c
, const char *playlist
, char ***tracksp
, int *ntracksp
) {
204 int rc
= disorder_simple(c
, NULL
, "playlist-get", playlist
, (char *)NULL
);
207 if(readlist(c
, tracksp
, ntracksp
))
212 int disorder_playlist_get_share(disorder_client
*c
, const char *playlist
, char **sharep
) {
213 return disorder_simple(c
, sharep
, "playlist-get-share", playlist
, (char *)NULL
);
216 int disorder_playlist_lock(disorder_client
*c
, const char *playlist
) {
217 return disorder_simple(c
, NULL
, "playlist-lock", playlist
, (char *)NULL
);
220 int disorder_playlist_set(disorder_client
*c
, const char *playlist
, char **tracks
, int ntracks
) {
221 return disorder_simple(c
, NULL
, "playlist-set", playlist
, disorder_body
, tracks
, ntracks
, (char *)NULL
);
224 int disorder_playlist_set_share(disorder_client
*c
, const char *playlist
, const char *share
) {
225 return disorder_simple(c
, NULL
, "playlist-set-share", playlist
, share
, (char *)NULL
);
228 int disorder_playlist_unlock(disorder_client
*c
) {
229 return disorder_simple(c
, NULL
, "playlist-unlock", (char *)NULL
);
232 int disorder_playlists(disorder_client
*c
, char ***playlistsp
, int *nplaylistsp
) {
233 int rc
= disorder_simple(c
, NULL
, "playlists", (char *)NULL
);
236 if(readlist(c
, playlistsp
, nplaylistsp
))
241 int disorder_prefs(disorder_client
*c
, const char *track
, struct kvp
**prefsp
) {
242 return pairlist(c
, prefsp
, "prefs", track
, (char *)NULL
);
245 int disorder_queue(disorder_client
*c
, struct queue_entry
**queuep
) {
246 int rc
= disorder_simple(c
, NULL
, "queue", (char *)NULL
);
249 if(readqueue(c
, queuep
))
254 int disorder_random_disable(disorder_client
*c
) {
255 return disorder_simple(c
, NULL
, "random-disable", (char *)NULL
);
258 int disorder_random_enable(disorder_client
*c
) {
259 return disorder_simple(c
, NULL
, "random-enable", (char *)NULL
);
262 int disorder_random_enabled(disorder_client
*c
, int *enabledp
) {
264 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "random-enabled", (char *)NULL
);
267 if(boolean("random-enabled", v
[0], enabledp
))
272 int disorder_recent(disorder_client
*c
, struct queue_entry
**recentp
) {
273 int rc
= disorder_simple(c
, NULL
, "recent", (char *)NULL
);
276 if(readqueue(c
, recentp
))
281 int disorder_reconfigure(disorder_client
*c
) {
282 return disorder_simple(c
, NULL
, "reconfigure", (char *)NULL
);
285 int disorder_register(disorder_client
*c
, const char *username
, const char *password
, const char *email
, char **confirmationp
) {
287 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "register", username
, password
, email
, (char *)NULL
);
290 *confirmationp
= v
[0];
294 int disorder_reminder(disorder_client
*c
, const char *username
) {
295 return disorder_simple(c
, NULL
, "reminder", username
, (char *)NULL
);
298 int disorder_remove(disorder_client
*c
, const char *id
) {
299 return disorder_simple(c
, NULL
, "remove", id
, (char *)NULL
);
302 int disorder_rescan(disorder_client
*c
) {
303 return disorder_simple(c
, NULL
, "rescan", (char *)NULL
);
306 int disorder_resolve(disorder_client
*c
, const char *track
, char **resolvedp
) {
308 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "resolve", track
, (char *)NULL
);
315 int disorder_resume(disorder_client
*c
) {
316 return disorder_simple(c
, NULL
, "resume", (char *)NULL
);
319 int disorder_revoke(disorder_client
*c
) {
320 return disorder_simple(c
, NULL
, "revoke", (char *)NULL
);
323 int disorder_rtp_address(disorder_client
*c
, char **addressp
, char **portp
) {
325 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 2, "rtp-address", (char *)NULL
);
333 int disorder_scratch(disorder_client
*c
, const char *id
) {
334 return disorder_simple(c
, NULL
, "scratch", id
, (char *)NULL
);
337 int disorder_schedule_add_play(disorder_client
*c
, time_t when
, const char *priority
, const char *track
) {
339 byte_snprintf(buf_when
, sizeof buf_when
, "%lld", (long long)when
);
340 return disorder_simple(c
, NULL
, "schedule-add", buf_when
, priority
, "play", track
, (char *)NULL
);
343 int disorder_schedule_add_set_global(disorder_client
*c
, time_t when
, const char *priority
, const char *pref
, const char *value
) {
345 byte_snprintf(buf_when
, sizeof buf_when
, "%lld", (long long)when
);
346 return disorder_simple(c
, NULL
, "schedule-add", buf_when
, priority
, "set-global", pref
, value
, (char *)NULL
);
349 int disorder_schedule_add_unset_global(disorder_client
*c
, time_t when
, const char *priority
, const char *pref
) {
351 byte_snprintf(buf_when
, sizeof buf_when
, "%lld", (long long)when
);
352 return disorder_simple(c
, NULL
, "schedule-add", buf_when
, priority
, "set-global", pref
, (char *)NULL
);
355 int disorder_schedule_del(disorder_client
*c
, const char *event
) {
356 return disorder_simple(c
, NULL
, "schedule-del", event
, (char *)NULL
);
359 int disorder_schedule_get(disorder_client
*c
, const char *id
, struct kvp
**actiondatap
) {
360 return pairlist(c
, actiondatap
, "schedule-get", id
, (char *)NULL
);
363 int disorder_schedule_list(disorder_client
*c
, char ***idsp
, int *nidsp
) {
364 int rc
= disorder_simple(c
, NULL
, "schedule-list", (char *)NULL
);
367 if(readlist(c
, idsp
, nidsp
))
372 int disorder_search(disorder_client
*c
, const char *terms
, char ***tracksp
, int *ntracksp
) {
373 int rc
= disorder_simple(c
, NULL
, "search", terms
, (char *)NULL
);
376 if(readlist(c
, tracksp
, ntracksp
))
381 int disorder_set(disorder_client
*c
, const char *track
, const char *pref
, const char *value
) {
382 return disorder_simple(c
, NULL
, "set", track
, pref
, value
, (char *)NULL
);
385 int disorder_set_global(disorder_client
*c
, const char *pref
, const char *value
) {
386 return disorder_simple(c
, NULL
, "set-global", pref
, value
, (char *)NULL
);
389 int disorder_shutdown(disorder_client
*c
) {
390 return disorder_simple(c
, NULL
, "shutdown", (char *)NULL
);
393 int disorder_stats(disorder_client
*c
, char ***statsp
, int *nstatsp
) {
394 int rc
= disorder_simple(c
, NULL
, "stats", (char *)NULL
);
397 if(readlist(c
, statsp
, nstatsp
))
402 int disorder_tags(disorder_client
*c
, char ***tagsp
, int *ntagsp
) {
403 int rc
= disorder_simple(c
, NULL
, "tags", (char *)NULL
);
406 if(readlist(c
, tagsp
, ntagsp
))
411 int disorder_unset(disorder_client
*c
, const char *track
, const char *pref
) {
412 return disorder_simple(c
, NULL
, "unset", track
, pref
, (char *)NULL
);
415 int disorder_unset_global(disorder_client
*c
, const char *pref
) {
416 return disorder_simple(c
, NULL
, "unset-global", pref
, (char *)NULL
);
419 int disorder_userinfo(disorder_client
*c
, const char *username
, const char *property
, char **valuep
) {
421 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "userinfo", username
, property
, (char *)NULL
);
428 int disorder_users(disorder_client
*c
, char ***usersp
, int *nusersp
) {
429 int rc
= disorder_simple(c
, NULL
, "users", (char *)NULL
);
432 if(readlist(c
, usersp
, nusersp
))
437 int disorder_version(disorder_client
*c
, char **versionp
) {
439 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 1, "version", (char *)NULL
);
446 int disorder_set_volume(disorder_client
*c
, long left
, long right
) {
448 byte_snprintf(buf_left
, sizeof buf_left
, "%ld", left
);
450 byte_snprintf(buf_right
, sizeof buf_right
, "%ld", right
);
451 return disorder_simple(c
, NULL
, "volume", buf_left
, buf_right
, (char *)NULL
);
454 int disorder_get_volume(disorder_client
*c
, long *leftp
, long *rightp
) {
456 int nv
, rc
= disorder_simple_split(c
, &v
, &nv
, 2, "volume", (char *)NULL
);
460 *rightp
= atol(v
[1]);