diff options
-rw-r--r-- | src/c_mpdview.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/c_mpdview.c b/src/c_mpdview.c index 3e09f11..91a8b4e 100644 --- a/src/c_mpdview.c +++ b/src/c_mpdview.c @@ -45,6 +45,8 @@ * This is the entrypoint of the program. */ +#include <mpd/response.h> +#include <mpd/song.h> #include <mpd/status.h> #include <stdlib.h> #include <stdio.h> @@ -64,7 +66,8 @@ main { struct mpd_connection* conn; struct mpd_status* status; - /* struct mpd_song* song; */ + struct mpd_song* song; + char* uri; enum mpd_state state; (void)argc; @@ -82,12 +85,20 @@ main } mpd_command_list_begin(conn, TRUE); mpd_send_status(conn); + mpd_send_current_song(conn); mpd_command_list_end(conn); status = mpd_recv_status(conn); state = mpd_status_get_state(status); mpd_status_free(status); status = NULL; if (state == MPD_STATE_PLAY || state == MPD_STATE_PAUSE) { + mpd_response_next(conn); + song = mpd_recv_song(conn); + uri = (char*)mpd_song_get_uri(song); + dprintf(STDOUT_FILENO, "Song: %s\n", uri); + mpd_song_free(song); + song = NULL; + mpd_response_finish(conn); } if (conn != NULL) { mpd_connection_free(conn); |