diff options
Diffstat (limited to 'src/c_mpdview.c')
-rw-r--r-- | src/c_mpdview.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/c_mpdview.c b/src/c_mpdview.c index 91a8b4e..4b0eece 100644 --- a/src/c_mpdview.c +++ b/src/c_mpdview.c @@ -45,16 +45,19 @@ * 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> +#include <string.h> #include <unistd.h> -#include <mpd/client.h> +#include <mpd/albumart.h> #include <mpd/connection.h> #include <mpd/error.h> +#include <mpd/list.h> +#include <mpd/player.h> +#include <mpd/response.h> +#include <mpd/song.h> +#include <mpd/status.h> #include "c_mpdview.h" @@ -67,7 +70,8 @@ main struct mpd_connection* conn; struct mpd_status* status; struct mpd_song* song; - char* uri; + char buff[BUFF_SIZE]; + /* char* uri; */ enum mpd_state state; (void)argc; @@ -94,11 +98,16 @@ main 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_response_finish(conn); + bzero(buff, BUFF_SIZE); + if (mpd_run_albumart(conn, mpd_song_get_uri(song), 0, buff, BUFF_SIZE) > -1) { + write(STDOUT_FILENO, buff, BUFF_SIZE); + } + else { + dprintf(STDOUT_FILENO, "Exit\n"); + } mpd_song_free(song); song = NULL; - mpd_response_finish(conn); } if (conn != NULL) { mpd_connection_free(conn); |