libmpdclient.h | libmpdclient.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
#ifndef LIBMPDCLIENT_H | #ifndef LIBMPDCLIENT_H | |||
#define LIBMPDCLIENT_H | #define LIBMPDCLIENT_H | |||
#ifdef WIN32 | #ifdef WIN32 | |||
# define __W32API_USE_DLLIMPORT__ 1 | # define __W32API_USE_DLLIMPORT__ 1 | |||
#endif | #endif | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#define MPD_BUFFER_MAX_LENGTH 50000 | #define MPD_BUFFER_MAX_LENGTH 50000 | |||
#define MPD_ERRORSTR_MAX_LENGTH 1000 | ||||
#define MPD_WELCOME_MESSAGE "OK MPD " | #define MPD_WELCOME_MESSAGE "OK MPD " | |||
#define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */ | #define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */ | |||
#define MPD_ERROR_SYSTEM 11 /* system error */ | #define MPD_ERROR_SYSTEM 11 /* system error */ | |||
#define MPD_ERROR_UNKHOST 12 /* unknown host */ | #define MPD_ERROR_UNKHOST 12 /* unknown host */ | |||
#define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */ | #define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */ | |||
#define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */ | #define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */ | |||
#define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect * / | #define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect * / | |||
#define MPD_ERROR_SENDING 16 /* error sending command */ | #define MPD_ERROR_SENDING 16 /* error sending command */ | |||
#define MPD_ERROR_CONNCLOSED 17 /* connection closed by mpd */ | #define MPD_ERROR_CONNCLOSED 17 /* connection closed by mpd */ | |||
skipping to change at line 91 | skipping to change at line 92 | |||
MPD_TAG_ITEM_TITLE, | MPD_TAG_ITEM_TITLE, | |||
MPD_TAG_ITEM_TRACK, | MPD_TAG_ITEM_TRACK, | |||
MPD_TAG_ITEM_NAME, | MPD_TAG_ITEM_NAME, | |||
MPD_TAG_ITEM_GENRE, | MPD_TAG_ITEM_GENRE, | |||
MPD_TAG_ITEM_DATE, | MPD_TAG_ITEM_DATE, | |||
MPD_TAG_ITEM_COMPOSER, | MPD_TAG_ITEM_COMPOSER, | |||
MPD_TAG_ITEM_PERFORMER, | MPD_TAG_ITEM_PERFORMER, | |||
MPD_TAG_ITEM_COMMENT, | MPD_TAG_ITEM_COMMENT, | |||
MPD_TAG_ITEM_DISC, | MPD_TAG_ITEM_DISC, | |||
MPD_TAG_ITEM_FILENAME, | MPD_TAG_ITEM_FILENAME, | |||
MPD_TAG_ITEM_ANY, | ||||
MPD_TAG_NUM_OF_ITEM_TYPES | MPD_TAG_NUM_OF_ITEM_TYPES | |||
}mpd_TagItems; | } mpd_TagItems; | |||
extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES]; | extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES]; | |||
/* internal stuff don't touch this struct */ | /* internal stuff don't touch this struct */ | |||
typedef struct _mpd_ReturnElement { | typedef struct _mpd_ReturnElement { | |||
char * name; | char * name; | |||
char * value; | char * value; | |||
} mpd_ReturnElement; | } mpd_ReturnElement; | |||
/* mpd_Connection | /* mpd_Connection | |||
* holds info about connection to mpd | * holds info about connection to mpd | |||
* use error, and errorStr to detect errors | * use error, and errorStr to detect errors | |||
*/ | */ | |||
typedef struct _mpd_Connection { | typedef struct _mpd_Connection { | |||
/* use this to check the version of mpd */ | /* use this to check the version of mpd */ | |||
int version[3]; | int version[3]; | |||
/* IMPORTANT, you want to get the error messages from here */ | /* IMPORTANT, you want to get the error messages from here */ | |||
char errorStr[MPD_BUFFER_MAX_LENGTH+1]; | char errorStr[MPD_ERRORSTR_MAX_LENGTH+1]; | |||
int errorCode; | int errorCode; | |||
int errorAt; | int errorAt; | |||
/* this will be set to MPD_ERROR_* if there is an error, 0 if not */ | /* this will be set to MPD_ERROR_* if there is an error, 0 if not */ | |||
int error; | int error; | |||
/* DON'T TOUCH any of the rest of this stuff */ | /* DON'T TOUCH any of the rest of this stuff */ | |||
int sock; | int sock; | |||
char buffer[MPD_BUFFER_MAX_LENGTH+1]; | char buffer[MPD_BUFFER_MAX_LENGTH+1]; | |||
int buflen; | int buflen; | |||
int bufstart; | int bufstart; | |||
int doneProcessing; | int doneProcessing; | |||
skipping to change at line 265 | skipping to change at line 267 | |||
* song, f.e. the icyName of the stream */ | * song, f.e. the icyName of the stream */ | |||
char * name; | char * name; | |||
/* date */ | /* date */ | |||
char *date; | char *date; | |||
/* added by qball */ | /* added by qball */ | |||
/* Genre */ | /* Genre */ | |||
char *genre; | char *genre; | |||
/* Composer */ | /* Composer */ | |||
char *composer; | char *composer; | |||
/* Performer */ | ||||
char *performer; | ||||
/* Disc */ | /* Disc */ | |||
char *disc; | char *disc; | |||
/* Comment */ | /* Comment */ | |||
char *comment; | char *comment; | |||
/* length of song in seconds, check that it is not MPD_SONG_NO_TIME */ | /* length of song in seconds, check that it is not MPD_SONG_NO_TIME */ | |||
int time; | int time; | |||
/* if plchanges/playlistinfo/playlistid used, is the position of the | /* if plchanges/playlistinfo/playlistid used, is the position of the | |||
* song in the playlist */ | * song in the playlist */ | |||
int pos; | int pos; | |||
skipping to change at line 417 | skipping to change at line 421 | |||
/* recursivel fetches all songs/dir/playlists in "dir* (no metadata is | /* recursivel fetches all songs/dir/playlists in "dir* (no metadata is | |||
* returned) */ | * returned) */ | |||
void mpd_sendListallCommand(mpd_Connection * connection, const char * dir); | void mpd_sendListallCommand(mpd_Connection * connection, const char * dir); | |||
/* same as sendListallCommand, but also metadata is returned */ | /* same as sendListallCommand, but also metadata is returned */ | |||
void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * d ir); | void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * d ir); | |||
/* non-recursive version of ListallInfo */ | /* non-recursive version of ListallInfo */ | |||
void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir); | void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir); | |||
#define MPD_TABLE_ARTIST 0 | #define MPD_TABLE_ARTIST MPD_TAG_ITEM_ARTIST | |||
#define MPD_TABLE_ALBUM 1 | #define MPD_TABLE_ALBUM MPD_TAG_ITEM_ALBUM | |||
#define MPD_TABLE_TITLE 2 | #define MPD_TABLE_TITLE MPD_TAG_ITEM_TITLE | |||
#define MPD_TABLE_FILENAME 3 | #define MPD_TABLE_FILENAME MPD_TAG_ITEM_FILENAME | |||
void mpd_sendSearchCommand(mpd_Connection * connection, int table, | void mpd_sendSearchCommand(mpd_Connection * connection, int table, | |||
const char * str); | const char * str); | |||
void mpd_sendFindCommand(mpd_Connection * connection, int table, | void mpd_sendFindCommand(mpd_Connection * connection, int table, | |||
const char * str); | const char * str); | |||
/* LIST TAG COMMANDS */ | /* LIST TAG COMMANDS */ | |||
/* use this function fetch next artist entry, be sure to free the returned | /* use this function fetch next artist entry, be sure to free the returned | |||
* string. NULL means there are no more. Best used with sendListArtists | * string. NULL means there are no more. Best used with sendListArtists | |||
*/ | */ | |||
char * mpd_getNextArtist(mpd_Connection * connection); | char * mpd_getNextArtist(mpd_Connection * connection); | |||
char * mpd_getNextAlbum(mpd_Connection * connection); | char * mpd_getNextAlbum(mpd_Connection * connection); | |||
char * mpd_getNextTag(mpd_Connection *connection, int table); | char * mpd_getNextTag(mpd_Connection *connection, int type); | |||
/* list artist or albums by artist, arg1 should be set to the artist if | /* list artist or albums by artist, arg1 should be set to the artist if | |||
* listing albums by a artist, otherwise NULL for listing all artists or al bums | * listing albums by a artist, otherwise NULL for listing all artists or al bums | |||
*/ | */ | |||
void mpd_sendListCommand(mpd_Connection * connection, int table, | void mpd_sendListCommand(mpd_Connection * connection, int table, | |||
const char * arg1); | const char * arg1); | |||
/* SIMPLE COMMANDS */ | /* SIMPLE COMMANDS */ | |||
void mpd_sendAddCommand(mpd_Connection * connection, const char * file); | void mpd_sendAddCommand(mpd_Connection * connection, const char * file); | |||
int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file); | ||||
void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum); | void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum); | |||
void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum); | void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum); | |||
void mpd_sendSaveCommand(mpd_Connection * connection, const char * name); | void mpd_sendSaveCommand(mpd_Connection * connection, const char * name); | |||
void mpd_sendLoadCommand(mpd_Connection * connection, const char * name); | void mpd_sendLoadCommand(mpd_Connection * connection, const char * name); | |||
void mpd_sendRmCommand(mpd_Connection * connection, const char * name); | void mpd_sendRmCommand(mpd_Connection * connection, const char * name); | |||
skipping to change at line 587 | skipping to change at line 595 | |||
*/ | */ | |||
void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path); | void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path); | |||
/** | /** | |||
* @param connection a #mpd_Connection | * @param connection a #mpd_Connection | |||
* @param exact if to match exact | * @param exact if to match exact | |||
* | * | |||
* starts a search, use mpd_addConstraintSearch to add | * starts a search, use mpd_addConstraintSearch to add | |||
* a constraint to the search, and mpd_commitSearch to do the actual search | * a constraint to the search, and mpd_commitSearch to do the actual search | |||
*/ | */ | |||
void mpd_startSearch(mpd_Connection * connection,int exact); | void mpd_startSearch(mpd_Connection *connection, int exact); | |||
/** | /** | |||
* @param connection a #mpd_Connection | * @param connection a #mpd_Connection | |||
* @param field | * @param type | |||
* @param name | * @param name | |||
* | ||||
*/ | */ | |||
void mpd_addConstraintSearch(mpd_Connection *connection, int field, char *n | void mpd_addConstraintSearch(mpd_Connection *connection, int type, const ch | |||
ame); | ar *name); | |||
/** | /** | |||
* @param connection a #mpd_Connection | * @param connection a #mpd_Connection | |||
* | ||||
*/ | */ | |||
void mpd_commitSearch(mpd_Connection *connection); | void mpd_commitSearch(mpd_Connection *connection); | |||
/** | /** | |||
* @param connection a #mpd_Connection | * @param connection a #mpd_Connection | |||
* @param field The field to search | * @param type The type to search for | |||
* | * | |||
* starts a search for fields... f.e. get a list of artists would be: | * starts a search for fields... f.e. get a list of artists would be: | |||
* @code | ||||
* mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | |||
* mpd_commitSearch(connection); | * mpd_commitSearch(connection); | |||
* @endcode | ||||
* | * | |||
* or get a list of artist in genre "jazz" would be: | * or get a list of artist in genre "jazz" would be: | |||
* @code | * @code | |||
* mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); | |||
* mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz") | * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz") | |||
* mpd_commitSearch(connection); | * mpd_commitSearch(connection); | |||
* @endcode | * @endcode | |||
* | * | |||
* mpd_startSearch will return a list of songs (and you need mpd_getNextIn foEntity) | * mpd_startSearch will return a list of songs (and you need mpd_getNextIn foEntity) | |||
* this one will return a list of only one field (the field specified with field) and you need | * this one will return a list of only one field (the one specified with ty pe) and you need | |||
* mpd_getNextTag to get the results | * mpd_getNextTag to get the results | |||
*/ | */ | |||
void mpd_startFieldSearch(mpd_Connection * connection,int field); | void mpd_startFieldSearch(mpd_Connection *connection, int type); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 18 change blocks. | ||||
16 lines changed or deleted | 24 lines changed or added | |||