2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 /* A simple synchronous client interface. */
26 typedef struct disorder_client disorder_client;
32 /* Parameter strings (e.g. @track@) are UTF-8 unless specified
35 disorder_client *disorder_new(int verbose);
36 /* create a new disorder_client */
38 int disorder_running(disorder_client *c);
39 /* return 1 if the server is running, else 0 */
41 int disorder_connect(disorder_client *c);
42 /* connect a disorder_client using the default settings */
44 int disorder_connect_sock(disorder_client *c,
45 const struct sockaddr *sa,
50 /* connect a disorder_client */
52 int disorder_close(disorder_client *c);
53 /* close a disorder_client */
55 int disorder_become(disorder_client *c, const char *user);
56 /* become another user (trusted users only) */
58 int disorder_version(disorder_client *c, char **versionp);
59 /* get the server version */
61 int disorder_play(disorder_client *c, const char *track);
62 /* add a track to the queue */
64 int disorder_remove(disorder_client *c, const char *track);
65 /* remove a track from the queue */
67 int disorder_move(disorder_client *c, const char *track, int delta);
68 /* move a track in the queue @delta@ steps towards the head */
70 int disorder_enable(disorder_client *c);
71 /* enable playing if it is not already enabled */
73 int disorder_disable(disorder_client *c);
74 /* disable playing if it is not already disabled. */
76 int disorder_scratch(disorder_client *c, const char *id);
77 /* scratch the currently playing track. If @id@ is not a null pointer
78 * then the scratch will be ignored if the ID does not mactch. */
80 int disorder_shutdown(disorder_client *c);
81 /* shut down the server immediately */
83 int disorder_reconfigure(disorder_client *c);
84 /* re-read the configuration file */
86 int disorder_rescan(disorder_client *c);
87 /* initiate a rescan */
89 int disorder_playing(disorder_client *c, struct queue_entry **qp);
90 /* get the details of the currently playing track (null pointer if
91 * nothing playing). The first entry in the list is the next track to
94 int disorder_recent(disorder_client *c, struct queue_entry **qp);
95 /* get a list of recently played tracks. The LAST entry in the list
96 * is last track to have been played. */
98 int disorder_queue(disorder_client *c, struct queue_entry **qp);
101 int disorder_directories(disorder_client *c, const char *dir, const char *re,
102 char ***vecp, int *nvecp);
103 /* get subdirectories of @dir@, or of the root if @dir@ is an null
106 int disorder_files(disorder_client *c, const char *dir, const char *re,
107 char ***vecp, int *nvecp);
108 /* get list of files in @dir@ */
110 int disorder_allfiles(disorder_client *c, const char *dir, const char *re,
111 char ***vecp, int *nvecp);
112 /* get list of files and directories in @dir@ */
114 char *disorder_user(disorder_client *c);
115 /* remind ourselves what user we went in as */
117 int disorder_exists(disorder_client *c, const char *track, int *existsp);
118 /* set @*existsp@ to 1 if the track exists, else 0 */
120 int disorder_enabled(disorder_client *c, int *enabledp);
121 /* set @*enabledp@ to 1 if playing enabled, else 0 */
123 int disorder_set(disorder_client *c, const char *track,
124 const char *key, const char *value);
125 int disorder_unset(disorder_client *c, const char *track,
127 int disorder_get(disorder_client *c, const char *track, const char *key,
129 int disorder_prefs(disorder_client *c, const char *track,
131 /* set, unset, get, list preferences */
133 int disorder_length(disorder_client *c, const char *track,
135 /* get the length of a track in seconds, if it is known */
137 int disorder_search(disorder_client *c, const char *terms,
138 char ***vecp, int *nvecp);
139 /* get a list of tracks matching @words@ */
141 int disorder_random_enable(disorder_client *c);
142 /* enable random play if it is not already enabled */
144 int disorder_random_disable(disorder_client *c);
145 /* disable random play if it is not already disabled */
147 int disorder_random_enabled(disorder_client *c, int *enabledp);
148 /* determine whether random play is enabled */
150 int disorder_stats(disorder_client *c,
151 char ***vecp, int *nvecp);
152 /* get server statistics */
154 int disorder_set_volume(disorder_client *c, int left, int right);
155 int disorder_get_volume(disorder_client *c, int *left, int *right);
156 /* get or set the volume */
158 int disorder_log(disorder_client *c, struct sink *s);
159 /* send log output to @s@ */
161 int disorder_part(disorder_client *c, char **partp,
162 const char *track, const char *context, const char *part);
163 /* get a track name part */
165 int disorder_resolve(disorder_client *c, char **trackp, const char *track);
166 /* resolve a track name */
168 int disorder_pause(disorder_client *c);
169 /* Pause the currently playing track. */
171 int disorder_resume(disorder_client *c);
172 /* Resume after a pause. */
174 int disorder_tags(disorder_client *c,
175 char ***vecp, int *nvecp);
178 int disorder_set_global(disorder_client *c,
179 const char *key, const char *value);
180 int disorder_unset_global(disorder_client *c, const char *key);
181 int disorder_get_global(disorder_client *c, const char *key, char **valuep);
182 /* get/unset/set global prefs */
184 int disorder_new_tracks(disorder_client *c,
185 char ***vecp, int *nvecp,
189 int disorder_rtp_address(disorder_client *c, char **addressp, char **portp);
191 #endif /* CLIENT_H */