Update vala version.
[gmpc.git] / src / vapi / libmpd.vapi
bloba855b00e6fcfc68f2983f520f9c3928a92c45b84
1 [CCode (cprefix = "mpd_", cheader_filename = "libmpd/libmpd.h")]
2 namespace MPD {
4     [CCode (cname = "MpdObj",cprefix="mpd_", cheader_filename="libmpd/libmpd.h")]
5     [Compact]
6     public class Server {
7         [CCode (cname="mpd_check_connected")]
8         public bool check_connected();
10         public bool connected { get { return check_connected();}}
12         public MPD.Song playlist_get_song(int songid);
13         public unowned MPD.Song playlist_get_current_song();
14         public int player_get_next_song_id();
15         [CCode (cname="mpd_server_get_database_update_time")]
16         public int get_database_update_time();
17         [CCode (cname="mpd_status_db_is_updating")]
18         public bool is_updating_database();
19         [CCode (cname="mpd_server_tag_supported")]
20         public bool tag_supported(MPD.Tag.Type tag);
21        
22         [CCode (cname="MpdServerCommand", cprefix="MPD_SERVER_COMMAND_") ]
23         public enum Command {
24             ALLOWED,
25             NOT_ALLOWED,
26             NOT_SUPPORTED,
27             ERROR
28         }
30         [CCode (cname="mpd_server_check_command_allowed") ]
31         public Command check_command_allowed(string command);
33         
34     }
37     [CCode (cname = "mpd_Song",free_function = "mpd_freeSong",copy_function = "mpd_songDup",has_type_id = false,cheader_filename = "libmpd/libmpdclient.h,libmpd/libmpd.h,misc.h")]
38     [Compact]
39     public class Song {
40         [CCode (cname = "mpd_newSong")]
41         public Song ();
42         public string? file;
43         public string? artist;
44         public string? title;
45         public string? album;
46         public string? track;
47         public string? name;
48         public string? date;
49         public string? genre;
50         public string? performer;
51         public string? disc;
52         public string? comment;
53         public string? albumartist;
54         public int    time;
55         public int    pos;
56         public int    id;
57         public int    priority;
58         public int    rating;
59         [CCode (cname="mpd_songDup0")]
60         public Song copy ();
61         [CCode (instance_pos = -1)]
62         public void markup (char[] buffer, string markup);
63     }
65     namespace Sticker {
66         namespace Song {
67             public void     set(MPD.Server connection, string file, string tag, string value);
68             public string   get(MPD.Server connection, string file, string tag);
69         }
71         public bool supported(MPD.Server connection);
72     }
74     namespace Status {
75         [CCode (cname="ChangedStatusType", cprefix = "MPD_CST_",cheader_filename = "libmpd/libmpd.h", has_type_id=false)]
76             public enum Changed {
77                 /** The playlist has changed */
78                 PLAYLIST      = 0x0001,
79                 /** The song position of the playing song has changed*/
80                 SONGPOS       = 0x0002,
81                 /** The songid of the playing song has changed */
82                 SONGID        = 0x0004,
83                 /** The database has changed. */
84                 DATABASE      = 0x0008,
85                 /** the state of updating the database has changed.*/
86                 UPDATING      = 0x0010,
87                 /** the volume has changed */
88                 VOLUME        = 0x0020,
89                 /** The total time of the currently playing song has changed*/
90                 TOTAL_TIME    = 0x0040,
91                 /** The elapsed time of the current song has changed.*/
92                 ELAPSED_TIME  = 0x0080,
93                 /** The crossfade time has changed. */
94                 CROSSFADE     = 0x0100,
95                 /** The random state is changed.     */
96                 RANDOM        = 0x0200,
97                 /** repeat state is changed.     */
98                 REPEAT        = 0x0400,
99                 /** Not implemented  */
100                 AUDIO         = 0x0800,
101                 /** The state of the player has changed.*/
102                 STATE         = 0x1000,
103                 /** The permissions the client has, has changed.*/
104                 PERMISSION    = 0x2000,
105                 /** The bitrate of the playing song has changed.    */
106                 BITRATE       = 0x4000,
107                 /** the audio format of the playing song changed.*/
108                 AUDIOFORMAT   = 0x8000,
109                 /** the queue has changed */
110                 STORED_PLAYLIST           = 0x20000,
111                 /** server error */
112                 SERVER_ERROR        = 0x40000,
113                 /** output changed */
114                 OUTPUT              = 0x80000,
115                 /** sticker changed */
116                 STICKER             = 0x100000,
117                 NEXTSONG            = 0x200000,
118                 SINGLE_MODE         = 0x400000,
119                 CONSUME_MODE        = 0x800000
120             }
122             [CCode (cname="mpd_status_get_bitrate")]
123             public int get_bitrate(MPD.Server server);
124             [CCode (cname="mpd_status_get_samplerate")]
125             public int get_samplerate(MPD.Server server);
126             [CCode (cname="mpd_status_get_channels")]
127             public int get_channels(MPD.Server server);
128     }
130     namespace Data{
131         [CCode (cname="MpdDataType", cprefix = "MPD_DATA_TYPE_", cheader_filename = "libmpd/libmpd.h")]
132             public enum Type {
133                 NONE,
134                 TAG,
135                 DIRECTORY,
136                 SONG,
137                 PLAYLIST,
138                 OUTPUT_DEV
139             }
141     [CCode (cname = "mpd_PlaylistFile", free_function = "mpd_freePlaylistFile", copy_function = "mpd_playlistFileDup", cheader_filename = "libmpd/libmpdclient.h,libmpd/libmpd.h")]
142     [Compact]
143     [Immutable]
144     public class Playlist{
145         [CCode (cname="mpd_newPlaylistFile")]
146         public Playlist();
148         public string *path;
149         public string *mtime;
150     }
152             [CCode (cname = "MpdData", free_function = "mpd_data_free", cheader_filename = "libmpd/libmpd.h")]
153             [Compact]
154             public class Item {
155                 public Data.Type type;
156                 public MPD.Song?  song;
157                 public string tag;
158                 public Playlist playlist;
160                 [CCode (cname="mpd_data_get_next")]
161                 [ReturnsModifiedPointer ()]
162                 public void next_free();
165                 [CCode (cheader_filename="misc.h", cname="misc_sort_mpddata_by_album_disc_track")]
166                 [ReturnsModifiedPointer ()]
167                 public void sort_album_disc_track();
169                 [CCode (cname="misc_mpddata_remove_duplicate_songs")]
170                 [ReturnsModifiedPointer ()]
171                 public void remove_duplicate_songs();
173                 [CCode (cname="mpd_data_get_next_real", cheader_filename="libmpd/libmpd-internal.h")]
174                 [ReturnsModifiedPointer ()]
175                 public void next(bool free);
177                 [CCode (cname="mpd_data_get_first")]
178                 public unowned Item? get_first();
180                 [CCode (cname="mpd_data_get_first")]
181                 [ReturnsModifiedPointer ()]
182                 public void first();
184                 [CCode (cname="mpd_data_concatenate")]
185                 [ReturnsModifiedPointer ()]
186                 public void concatenate(owned MPD.Data.Item b);
188                 [CCode (cname="mpd_new_data_struct_append")]
189                 [ReturnsModifiedPointer ()]
190                 public void append_new();
191             }
193             [CCode (cname = "mpd_SearchStats", free_function = "mpd_freeSearchStats", cheader_filename = "libmpd/libmpdclient.h")]
194             [Compact]
195             public class SearchStats
196             {
197                 public int numberOfSongs;
198                 public ulong playTime;
199             }
200     }
202     namespace PlayQueue {
203         [CCode (cname="mpd_playlist_set_priority")]
204         public void set_priority(MPD.Server server, int song_id, int priority);
206         [CCode (cname="mpd_playlist_add")]
207         public void add_song(MPD.Server server, string path);
209         [CCode (cname="mpd_playlist_add_get_id")]
210         public int add_song_get_id(MPD.Server server, string path);
212         [CCode (cname="mpd_playlist_move_id")]
213         public void song_move_id(MPD.Server server, int songid, int position);
215         [CCode (cname="mpd_playlist_queue_delete_id")]
216         public void queue_delete_id(MPD.Server server, int song_id);
218         [CCode (cname="mpd_playlist_queue_load")]
219         public void queue_load_playlist(MPD.Server server, string path);
221         [CCode (cname="mpd_playlist_queue_add")]
222         public void queue_add_song(MPD.Server server, string path);
223         [CCode (cname="mpd_playlist_queue_commit")]
224         public void queue_commit(MPD.Server server);
225         [CCode (cname="mpd_playlist_clear")]
226         public void clear(MPD.Server server);
227                 [CCode (cname="mpd_playlist_get_playlist_length")]
228                 public int length(MPD.Server server);
230         public void add_artist(MPD.Server server, string artist)
231         {
232             MPD.Database.search_start(server,true);
233             MPD.Database.search_add_constraint(server, MPD.Tag.Type.ARTIST, artist);
234             var data = MPD.Database.search_commit(server);
235             if(data != null) {
236                 data.sort_album_disc_track();
237                 while(data != null){
238                     MPD.PlayQueue.queue_add_song(server, data.song.file);
239                     data.next_free();
240                 }
241                 MPD.PlayQueue.queue_commit(server);
242             }
243         }
245         public void add_album(MPD.Server server, string? artist, string? album, string? album_artist=null)
246         {
247             MPD.Database.search_start(server,true);
248             if(album_artist != null)
249                 MPD.Database.search_add_constraint(server, MPD.Tag.Type.ALBUM_ARTIST, album_artist);
250             else
251                 MPD.Database.search_add_constraint(server, MPD.Tag.Type.ARTIST, artist);
252             MPD.Database.search_add_constraint(server, MPD.Tag.Type.ALBUM, album);
253             var data = MPD.Database.search_commit(server);
254             if(data != null) {
255                 data.sort_album_disc_track();
256                 while(data != null){
257                     MPD.PlayQueue.queue_add_song(server, data.song.file);
258                     data.next_free();
259                 }
260                 MPD.PlayQueue.queue_commit(server);
261             }
262         }
263     }
265     namespace Player {
266         [CCode (cname="mpd_player_play")]
267         public void play(MPD.Server server);
268         [CCode (cname="mpd_player_play_id")]
269         public void play_id (MPD.Server server, int song_id);
270         public void next(MPD.Server server);
271         public void prev(MPD.Server server);
272         public void pause(MPD.Server server);
273         public void stop(MPD.Server server);
274         public MPD.Player.State get_state(MPD.Server server);
276         [CCode (cprefix="MPD_STATUS_STATE_", cname="int")]
277         public enum State{
278             UNKNOWN = 0,
279             STOP    = 1,
280             PLAY    = 2,
281             PAUSE   = 3
282         }
283     }
285     namespace Database {
286         public MPD.Data.Item? get_playlist_content(MPD.Server server, string playlist_name);
287         [CCode (cname="mpd_database_playlist_list")]
288         public MPD.Data.Item? get_playlist_list(MPD.Server server);
289         public void playlist_list_add(MPD.Server server, string playlist_name, string path);
290         public void playlist_list_delete(MPD.Server server, string playlist_name, int pos);
291         public void playlist_clear(MPD.Server server, string playlist_name);
292         public void playlist_move(MPD.Server server, string playlist_name, int old_pos, int new_pos);
294         [CCode (cname="mpd_database_search_field_start")]
295         public void search_field_start(MPD.Server server,MPD.Tag.Type type);
297         [CCode (cname="mpd_database_search_start")]
298         public void search_start(MPD.Server server,bool exact);
299         public MPD.Data.Item? search_commit(MPD.Server server);
301         [CCode (cname="mpd_database_search_stats_start")]
302         public void search_stats_start(MPD.Server server);
303         public MPD.Data.SearchStats? search_stats_commit(MPD.Server server);
305         [CCode (cname="mpd_database_search_add_constraint")]
306         public void search_add_constraint(MPD.Server server, MPD.Tag.Type type, string value);
308     }
310     namespace Tag {
311         [CCode (cname="mpd_TagItems", cprefix = "MPD_TAG_ITEM_", cheader_filename = "libmpd/libmpdclient.h")]
312             public enum Type{
313                 ARTIST,
314                     ALBUM,
315                     TITLE,
316                     TRACK,
317                     NAME,
318                     GENRE,
319                     DATE,
320                     COMPOSER,
321                     PERFORMER,
322                     COMMENT,
323                     DISC,
324                     FILENAME,
325                     ALBUM_ARTIST,
326                     ANY
327             }
328     }