From f402cc0b5ad889ab474218f518b2362efa7d0f22 Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 3 Jul 2022 03:22:32 +0200 Subject: WIP --- src/c_mpdview.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/c_mpdview.c') 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 +#include #include #include #include @@ -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); -- cgit v1.2.3