* Updated to libmpdclient 0.13.0
[monky] / src / libmpdclient.h
1 /* libmpdclient
2    (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
3    This project's homepage is: http://www.musicpd.org
4
5    Redistribution and use in source and binary forms, with or without
6    modification, are permitted provided that the following conditions
7    are met:
8
9    - Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11
12    - Redistributions in binary form must reproduce the above copyright
13    notice, this list of conditions and the following disclaimer in the
14    documentation and/or other materials provided with the distribution.
15
16    - Neither the name of the Music Player Daemon nor the names of its
17    contributors may be used to endorse or promote products derived from
18    this software without specific prior written permission.
19
20    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
24    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef LIBMPDCLIENT_H
34 #define LIBMPDCLIENT_H
35
36 #ifdef WIN32
37 #  define __W32API_USE_DLLIMPORT__ 1
38 #endif
39
40 #include <sys/time.h>
41 #include <stdarg.h>
42 #define MPD_BUFFER_MAX_LENGTH   50000
43 #define MPD_ERRORSTR_MAX_LENGTH 1000
44 #define MPD_WELCOME_MESSAGE     "OK MPD "
45
46 #define MPD_ERROR_TIMEOUT       10 /* timeout trying to talk to mpd */
47 #define MPD_ERROR_SYSTEM        11 /* system error */
48 #define MPD_ERROR_UNKHOST       12 /* unknown host */
49 #define MPD_ERROR_CONNPORT      13 /* problems connecting to port on host */
50 #define MPD_ERROR_NOTMPD        14 /* mpd not running on port at host */
51 #define MPD_ERROR_NORESPONSE    15 /* no response on attempting to connect */
52 #define MPD_ERROR_SENDING       16 /* error sending command */
53 #define MPD_ERROR_CONNCLOSED    17 /* connection closed by mpd */
54 #define MPD_ERROR_ACK           18 /* ACK returned! */
55 #define MPD_ERROR_BUFFEROVERRUN 19 /* Buffer was overrun! */
56
57 #define MPD_ACK_ERROR_UNK       -1
58 #define MPD_ERROR_AT_UNK        -1
59
60 #define MPD_ACK_ERROR_NOT_LIST                  1
61 #define MPD_ACK_ERROR_ARG                       2
62 #define MPD_ACK_ERROR_PASSWORD                  3
63 #define MPD_ACK_ERROR_PERMISSION                4
64 #define MPD_ACK_ERROR_UNKNOWN_CMD               5
65
66 #define MPD_ACK_ERROR_NO_EXIST                  50
67 #define MPD_ACK_ERROR_PLAYLIST_MAX              51
68 #define MPD_ACK_ERROR_SYSTEM                    52
69 #define MPD_ACK_ERROR_PLAYLIST_LOAD             53
70 #define MPD_ACK_ERROR_UPDATE_ALREADY            54
71 #define MPD_ACK_ERROR_PLAYER_SYNC               55
72 #define MPD_ACK_ERROR_EXIST                     56
73
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77
78 typedef enum mpd_TagItems
79 {
80         MPD_TAG_ITEM_ARTIST,
81         MPD_TAG_ITEM_ALBUM,
82         MPD_TAG_ITEM_TITLE,
83         MPD_TAG_ITEM_TRACK,
84         MPD_TAG_ITEM_NAME,
85         MPD_TAG_ITEM_GENRE,
86         MPD_TAG_ITEM_DATE,
87         MPD_TAG_ITEM_COMPOSER,
88         MPD_TAG_ITEM_PERFORMER,
89         MPD_TAG_ITEM_COMMENT,
90         MPD_TAG_ITEM_DISC,
91         MPD_TAG_ITEM_FILENAME,
92         MPD_TAG_ITEM_ANY,
93         MPD_TAG_NUM_OF_ITEM_TYPES
94 } mpd_TagItems;
95
96 extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES];
97
98 /* internal stuff don't touch this struct */
99 typedef struct _mpd_ReturnElement {
100         char * name;
101         char * value;
102 } mpd_ReturnElement;
103
104 /* mpd_Connection
105  * holds info about connection to mpd
106  * use error, and errorStr to detect errors
107  */
108 typedef struct _mpd_Connection {
109         /* use this to check the version of mpd */
110         int version[3];
111         /* IMPORTANT, you want to get the error messages from here */
112         char errorStr[MPD_ERRORSTR_MAX_LENGTH+1];
113         int errorCode;
114         int errorAt;
115         /* this will be set to MPD_ERROR_* if there is an error, 0 if not */
116         int error;
117         /* DON'T TOUCH any of the rest of this stuff */
118         int sock;
119         char buffer[MPD_BUFFER_MAX_LENGTH+1];
120         int buflen;
121         int bufstart;
122         int doneProcessing;
123         int listOks;
124         int doneListOk;
125         int commandList;
126         mpd_ReturnElement * returnElement;
127         struct timeval timeout;
128         char *request;
129 } mpd_Connection;
130
131 /* mpd_newConnection
132  * use this to open a new connection
133  * you should use mpd_closeConnection, when your done with the connection,
134  * even if an error has occurred
135  * _timeout_ is the connection timeout period in seconds
136  */
137 mpd_Connection * mpd_newConnection(const char * host, int port, float timeout);
138
139 void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout);
140
141 /* mpd_closeConnection
142  * use this to close a connection and free'ing subsequent memory
143  */
144 void mpd_closeConnection(mpd_Connection * connection);
145
146 /* mpd_clearError
147  * clears error
148  */
149 void mpd_clearError(mpd_Connection * connection);
150
151 /* STATUS STUFF */
152
153 /* use these with status.state to determine what state the player is in */
154 #define MPD_STATUS_STATE_UNKNOWN        0
155 #define MPD_STATUS_STATE_STOP           1
156 #define MPD_STATUS_STATE_PLAY           2
157 #define MPD_STATUS_STATE_PAUSE          3
158
159 /* us this with status.volume to determine if mpd has volume support */
160 #define MPD_STATUS_NO_VOLUME            -1
161
162 /* mpd_Status
163  * holds info return from status command
164  */
165 typedef struct mpd_Status {
166         /* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */
167         int volume;
168         /* 1 if repeat is on, 0 otherwise */
169         int repeat;
170         /* 1 if random is on, 0 otherwise */
171         int random;
172         /* playlist length */
173         int playlistLength;
174         /* playlist, use this to determine when the playlist has changed */
175         long long playlist;
176         /* use with MPD_STATUS_STATE_* to determine state of player */
177         int state;
178         /* crossfade setting in seconds */
179         int crossfade;
180         /* if a song is currently selected (always the case when state is
181          * PLAY or PAUSE), this is the position of the currently
182          * playing song in the playlist, beginning with 0
183          */
184         int song;
185         /* Song ID of the currently selected song */
186         int songid;
187         /* time in seconds that have elapsed in the currently playing/paused
188          * song
189          */
190         int elapsedTime;
191         /* length in seconds of the currently playing/paused song */
192         int totalTime;
193         /* current bit rate in kbs */
194         int bitRate;
195         /* audio sample rate */
196         unsigned int sampleRate;
197         /* audio bits */
198         int bits;
199         /* audio channels */
200         int channels;
201         /* 1 if mpd is updating, 0 otherwise */
202         int updatingDb;
203         /* error */
204         char * error;
205 } mpd_Status;
206
207 void mpd_sendStatusCommand(mpd_Connection * connection);
208
209 /* mpd_getStatus
210  * returns status info, be sure to free it with mpd_freeStatus()
211  * call this after mpd_sendStatusCommand()
212  */
213 mpd_Status * mpd_getStatus(mpd_Connection * connection);
214
215 /* mpd_freeStatus
216  * free's status info malloc'd and returned by mpd_getStatus
217  */
218 void mpd_freeStatus(mpd_Status * status);
219
220 typedef struct _mpd_Stats {
221         int numberOfArtists;
222         int numberOfAlbums;
223         int numberOfSongs;
224         unsigned long uptime;
225         unsigned long dbUpdateTime;
226         unsigned long playTime;
227         unsigned long dbPlayTime;
228 } mpd_Stats;
229
230 typedef struct _mpd_SearchStats {
231         int numberOfSongs;
232         unsigned long playTime;
233 } mpd_SearchStats;
234
235 void mpd_sendStatsCommand(mpd_Connection * connection);
236
237 mpd_Stats * mpd_getStats(mpd_Connection * connection);
238
239 void mpd_freeStats(mpd_Stats * stats);
240
241 mpd_SearchStats * mpd_getSearchStats(mpd_Connection * connection);
242
243 void mpd_freeSearchStats(mpd_SearchStats * stats);
244
245 /* SONG STUFF */
246
247 #define MPD_SONG_NO_TIME        -1
248 #define MPD_SONG_NO_NUM         -1
249 #define MPD_SONG_NO_ID          -1
250
251 /* mpd_Song
252  * for storing song info returned by mpd
253  */
254 typedef struct _mpd_Song {
255         /* filename of song */
256         char * file;
257         /* artist, maybe NULL if there is no tag */
258         char * artist;
259         /* title, maybe NULL if there is no tag */
260         char * title;
261         /* album, maybe NULL if there is no tag */
262         char * album;
263         /* track, maybe NULL if there is no tag */
264         char * track;
265         /* name, maybe NULL if there is no tag; it's the name of the current
266          * song, f.e. the icyName of the stream */
267         char * name;
268         /* date */
269         char *date;
270
271         /* added by qball */
272         /* Genre */
273         char *genre;
274         /* Composer */
275         char *composer;
276         /* Performer */
277         char *performer;
278         /* Disc */
279         char *disc;
280         /* Comment */
281         char *comment;
282
283         /* length of song in seconds, check that it is not MPD_SONG_NO_TIME  */
284         int time;
285         /* if plchanges/playlistinfo/playlistid used, is the position of the
286          * song in the playlist */
287         int pos;
288         /* song id for a song in the playlist */
289         int id;
290 } mpd_Song;
291
292 /* mpd_newSong
293  * use to allocate memory for a new mpd_Song
294  * file, artist, etc all initialized to NULL
295  * if your going to assign values to file, artist, etc
296  * be sure to malloc or strdup the memory
297  * use mpd_freeSong to free the memory for the mpd_Song, it will also
298  * free memory for file, artist, etc, so don't do it yourself
299  */
300 mpd_Song * mpd_newSong(void);
301
302 /* mpd_freeSong
303  * use to free memory allocated by mpd_newSong
304  * also it will free memory pointed to by file, artist, etc, so be careful
305  */
306 void mpd_freeSong(mpd_Song * song);
307
308 /* mpd_songDup
309  * works like strDup, but for a mpd_Song
310  */
311 mpd_Song * mpd_songDup(mpd_Song * song);
312
313 /* DIRECTORY STUFF */
314
315 /* mpd_Directory
316  * used to store info fro directory (right now that just the path)
317  */
318 typedef struct _mpd_Directory {
319         char * path;
320 } mpd_Directory;
321
322 /* mpd_newDirectory
323  * allocates memory for a new directory
324  * use mpd_freeDirectory to free this memory
325  */
326 mpd_Directory * mpd_newDirectory(void);
327
328 /* mpd_freeDirectory
329  * used to free memory allocated with mpd_newDirectory, and it frees
330  * path of mpd_Directory, so be careful
331  */
332 void mpd_freeDirectory(mpd_Directory * directory);
333
334 /* mpd_directoryDup
335  * works like strdup, but for mpd_Directory
336  */
337 mpd_Directory * mpd_directoryDup(mpd_Directory * directory);
338
339 /* PLAYLISTFILE STUFF */
340
341 /* mpd_PlaylistFile
342  * stores info about playlist file returned by lsinfo
343  */
344 typedef struct _mpd_PlaylistFile {
345         char * path;
346 } mpd_PlaylistFile;
347
348 /* mpd_newPlaylistFile
349  * allocates memory for new mpd_PlaylistFile, path is set to NULL
350  * free this memory with mpd_freePlaylistFile
351  */
352 mpd_PlaylistFile * mpd_newPlaylistFile(void);
353
354 /* mpd_freePlaylist
355  * free memory allocated for freePlaylistFile, will also free
356  * path, so be careful
357  */
358 void mpd_freePlaylistFile(mpd_PlaylistFile * playlist);
359
360 /* mpd_playlistFileDup
361  * works like strdup, but for mpd_PlaylistFile
362  */
363 mpd_PlaylistFile * mpd_playlistFileDup(mpd_PlaylistFile * playlist);
364
365 /* INFO ENTITY STUFF */
366
367 /* the type of entity returned from one of the commands that generates info
368  * use in conjunction with mpd_InfoEntity.type
369  */
370 #define MPD_INFO_ENTITY_TYPE_DIRECTORY          0
371 #define MPD_INFO_ENTITY_TYPE_SONG               1
372 #define MPD_INFO_ENTITY_TYPE_PLAYLISTFILE       2
373
374 /* mpd_InfoEntity
375  * stores info on stuff returned info commands
376  */
377 typedef struct mpd_InfoEntity {
378         /* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine
379          * what this entity is (song, directory, etc...)
380          */
381         int type;
382         /* the actual data you want, mpd_Song, mpd_Directory, etc */
383         union {
384                 mpd_Directory * directory;
385                 mpd_Song * song;
386                 mpd_PlaylistFile * playlistFile;
387         } info;
388 } mpd_InfoEntity;
389
390 mpd_InfoEntity * mpd_newInfoEntity(void);
391
392 void mpd_freeInfoEntity(mpd_InfoEntity * entity);
393
394 /* INFO COMMANDS AND STUFF */
395
396 /* use this function to loop over after calling Info/Listall functions */
397 mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection);
398
399 /* fetches the currently seeletect song (the song referenced by status->song
400  * and status->songid*/
401 void mpd_sendCurrentSongCommand(mpd_Connection * connection);
402
403 /* songNum of -1, means to display the whole list */
404 void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum);
405
406 /* songId of -1, means to display the whole list */
407 void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId);
408
409 /* use this to get the changes in the playlist since version _playlist_ */
410 void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist);
411
412 /**
413  * @param connection: A valid and connected mpd_Connection.
414  * @param playlist: The playlist version you want the diff with.
415  * A more bandwidth efficient version of the mpd_sendPlChangesCommand.
416  * It only returns the pos+id of the changes song.
417  */
418 void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long playlist);
419
420 /* recursivel fetches all songs/dir/playlists in "dir* (no metadata is
421  * returned) */
422 void mpd_sendListallCommand(mpd_Connection * connection, const char * dir);
423
424 /* same as sendListallCommand, but also metadata is returned */
425 void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * dir);
426
427 /* non-recursive version of ListallInfo */
428 void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir);
429
430 #define MPD_TABLE_ARTIST        MPD_TAG_ITEM_ARTIST
431 #define MPD_TABLE_ALBUM         MPD_TAG_ITEM_ALBUM
432 #define MPD_TABLE_TITLE         MPD_TAG_ITEM_TITLE
433 #define MPD_TABLE_FILENAME      MPD_TAG_ITEM_FILENAME
434
435 void mpd_sendSearchCommand(mpd_Connection * connection, int table,
436                 const char * str);
437
438 void mpd_sendFindCommand(mpd_Connection * connection, int table,
439                 const char * str);
440
441 /* LIST TAG COMMANDS */
442
443 /* use this function fetch next artist entry, be sure to free the returned
444  * string.  NULL means there are no more.  Best used with sendListArtists
445  */
446 char * mpd_getNextArtist(mpd_Connection * connection);
447
448 char * mpd_getNextAlbum(mpd_Connection * connection);
449
450 char * mpd_getNextTag(mpd_Connection *connection, int type);
451
452 /* list artist or albums by artist, arg1 should be set to the artist if
453  * listing albums by a artist, otherwise NULL for listing all artists or albums
454  */
455 void mpd_sendListCommand(mpd_Connection * connection, int table,
456                 const char * arg1);
457
458 /* SIMPLE COMMANDS */
459
460 void mpd_sendAddCommand(mpd_Connection * connection, const char * file);
461
462 int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file);
463
464 void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum);
465
466 void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum);
467
468 void mpd_sendSaveCommand(mpd_Connection * connection, const char * name);
469
470 void mpd_sendLoadCommand(mpd_Connection * connection, const char * name);
471
472 void mpd_sendRmCommand(mpd_Connection * connection, const char * name);
473
474 void mpd_sendRenameCommand(mpd_Connection *connection, const char *from,
475                            const char *to);
476
477 void mpd_sendShuffleCommand(mpd_Connection * connection);
478
479 void mpd_sendClearCommand(mpd_Connection * connection);
480
481 /* use this to start playing at the beginning, useful when in random mode */
482 #define MPD_PLAY_AT_BEGINNING   -1
483
484 void mpd_sendPlayCommand(mpd_Connection * connection, int songNum);
485
486 void mpd_sendPlayIdCommand(mpd_Connection * connection, int songNum);
487
488 void mpd_sendStopCommand(mpd_Connection * connection);
489
490 void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode);
491
492 void mpd_sendNextCommand(mpd_Connection * connection);
493
494 void mpd_sendPrevCommand(mpd_Connection * connection);
495
496 void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to);
497
498 void mpd_sendMoveIdCommand(mpd_Connection * connection, int from, int to);
499
500 void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2);
501
502 void mpd_sendSwapIdCommand(mpd_Connection * connection, int song1, int song2);
503
504 void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time);
505
506 void mpd_sendSeekIdCommand(mpd_Connection * connection, int song, int time);
507
508 void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode);
509
510 void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode);
511
512 void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange);
513
514 /* WARNING: don't use volume command, its depreacted */
515 void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange);
516
517 void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds);
518
519 void mpd_sendUpdateCommand(mpd_Connection * connection, char * path);
520
521 /* returns the update job id, call this after a update command*/
522 int mpd_getUpdateId(mpd_Connection * connection);
523
524 void mpd_sendPasswordCommand(mpd_Connection * connection, const char * pass);
525
526 /* after executing a command, when your done with it to get its status
527  * (you want to check connection->error for an error)
528  */
529 void mpd_finishCommand(mpd_Connection * connection);
530
531 /* command list stuff, use this to do things like add files very quickly */
532 void mpd_sendCommandListBegin(mpd_Connection * connection);
533
534 void mpd_sendCommandListOkBegin(mpd_Connection * connection);
535
536 void mpd_sendCommandListEnd(mpd_Connection * connection);
537
538 /* advance to the next listOk
539  * returns 0 if advanced to the next list_OK,
540  * returns -1 if it advanced to an OK or ACK */
541 int mpd_nextListOkCommand(mpd_Connection * connection);
542
543 typedef struct _mpd_OutputEntity {
544         int id;
545         char * name;
546         int enabled;
547 } mpd_OutputEntity;
548
549 void mpd_sendOutputsCommand(mpd_Connection * connection);
550
551 mpd_OutputEntity * mpd_getNextOutput(mpd_Connection * connection);
552
553 void mpd_sendEnableOutputCommand(mpd_Connection * connection, int outputId);
554
555 void mpd_sendDisableOutputCommand(mpd_Connection * connection, int outputId);
556
557 void mpd_freeOutputElement(mpd_OutputEntity * output);
558
559 /**
560  * @param connection a #mpd_Connection
561  *
562  * Queries mpd for the allowed commands
563  */
564 void mpd_sendCommandsCommand(mpd_Connection * connection);
565
566 /**
567  * @param connection a #mpd_Connection
568  *
569  * Queries mpd for the not allowed commands
570  */
571 void mpd_sendNotCommandsCommand(mpd_Connection * connection);
572
573 /**
574  * @param connection a #mpd_Connection
575  *
576  * returns the next supported command.
577  *
578  * @returns a string, needs to be free'ed
579  */
580 char *mpd_getNextCommand(mpd_Connection *connection);
581
582 void mpd_sendUrlHandlersCommand(mpd_Connection * connection);
583
584 char *mpd_getNextHandler(mpd_Connection * connection);
585
586 void mpd_sendTagTypesCommand(mpd_Connection * connection);
587
588 char *mpd_getNextTagType(mpd_Connection * connection);
589
590 /**
591  * @param connection a MpdConnection
592  * @param path  the path to the playlist.
593  *
594  * List the content, with full metadata, of a stored playlist.
595  *
596  */
597 void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path);
598
599 /**
600  * @param connection a MpdConnection
601  * @param path  the path to the playlist.
602  *
603  * List the content of a stored playlist.
604  *
605  */
606 void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path);
607
608 /**
609  * @param connection a #mpd_Connection
610  * @param exact if to match exact
611  *
612  * starts a search, use mpd_addConstraintSearch to add
613  * a constraint to the search, and mpd_commitSearch to do the actual search
614  */
615 void mpd_startSearch(mpd_Connection *connection, int exact);
616
617 /**
618  * @param connection a #mpd_Connection
619  * @param type
620  * @param name
621  */
622 void mpd_addConstraintSearch(mpd_Connection *connection, int type, const char *name);
623
624 /**
625  * @param connection a #mpd_Connection
626  */
627 void mpd_commitSearch(mpd_Connection *connection);
628
629 /**
630  * @param connection a #mpd_Connection
631  * @param type The type to search for
632  *
633  * starts a search for fields... f.e. get a list of artists would be:
634  * @code
635  * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
636  * mpd_commitSearch(connection);
637  * @endcode
638  *
639  * or get a list of artist in genre "jazz" would be:
640  * @code
641  * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
642  * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz")
643  * mpd_commitSearch(connection);
644  * @endcode
645  *
646  * mpd_startSearch will return  a list of songs (and you need mpd_getNextInfoEntity)
647  * this one will return a list of only one field (the one specified with type) and you need
648  * mpd_getNextTag to get the results
649  */
650 void mpd_startFieldSearch(mpd_Connection *connection, int type);
651
652 void mpd_startPlaylistSearch(mpd_Connection *connection, int exact);
653
654 void mpd_startStatsSearch(mpd_Connection *connection);
655
656 void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path);
657
658 void mpd_sendPlaylistAddCommand(mpd_Connection *connection,
659                                 char *playlist, char *path);
660
661 void mpd_sendPlaylistMoveCommand(mpd_Connection *connection,
662                                  char *playlist, int from, int to);
663
664 void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection,
665                                    char *playlist, int pos);
666 #ifdef __cplusplus
667 }
668 #endif
669
670 #endif