From: Kalle Wallin Date: Sun, 5 Jun 2005 21:34:52 +0000 (+0000) Subject: libmpdclient update X-Git-Tag: v0.12_alpha1~424 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=52b6a93f9773256f6d5a0efbd420fac83b3ed10b;p=ncmpc.git libmpdclient update git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3320 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/src/libmpdclient.c b/src/libmpdclient.c index e93b394..bc1c1d6 100644 --- a/src/libmpdclient.c +++ b/src/libmpdclient.c @@ -69,25 +69,33 @@ int mpd_ipv6Supported() { } #endif - -char * mpd_sanitizeArg(const char * arg) { +static char * mpd_sanitizeArg(const char * arg) { size_t i; - int count=0; char * ret; - - for(i=0;ititle = NULL; song->name = NULL; song->date = NULL; + /* added by Qball */ + song->genre = NULL; + song->composer = NULL; + song->time = MPD_SONG_NO_TIME; song->pos = MPD_SONG_NO_NUM; song->id = MPD_SONG_NO_ID; @@ -802,6 +814,8 @@ void mpd_finishSong(mpd_Song * song) { if(song->track) free(song->track); if(song->name) free(song->name); if(song->date) free(song->date); + if(song->genre) free(song->genre); + if(song->composer) free(song->composer); } mpd_Song * mpd_newSong() { @@ -827,6 +841,8 @@ mpd_Song * mpd_songDup(mpd_Song * song) { if(song->track) ret->track = strdup(song->track); if(song->name) ret->name = strdup(song->name); if(song->date) ret->date = strdup(song->date); + if(song->genre) ret->genre= strdup(song->genre); + if(song->composer) ret->composer= strdup(song->composer); ret->time = song->time; ret->pos = song->pos; ret->id = song->id; @@ -1016,6 +1032,15 @@ mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection) { strcmp(re->name, "Date") == 0) { entity->info.song->date = strdup(re->value); } + else if(!entity->info.song->genre && + strcmp(re->name, "Genre") == 0) { + entity->info.song->genre = strdup(re->value); + } + else if(!entity->info.song->composer && + strcmp(re->name, "Composer") == 0) { + entity->info.song->composer = strdup(re->value); + } + } else if(entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) { } diff --git a/src/libmpdclient.h b/src/libmpdclient.h index 9298a09..79a94d8 100644 --- a/src/libmpdclient.h +++ b/src/libmpdclient.h @@ -233,6 +233,11 @@ typedef struct _mpd_Song { char * name; /* date */ char *date; + + /* added by qball */ + char *genre; + char *composer; + /* length of song in seconds, check that it is not MPD_SONG_NO_TIME */ int time; /* if plchanges/playlistinfo/playlistid used, is the position of the @@ -356,6 +361,9 @@ void mpd_sendCurrentSongCommand(mpd_Connection * connection); /* songNum of -1, means to display the whole list */ void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum); +/* songId of -1, means to display the whole list */ +void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId); + /* use this to get the changes in the playlist since version _playlist_ */ void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist);