summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-07-03 03:22:32 +0200
committerJoe <bousset.rudy@gmail.com>2022-07-03 03:22:32 +0200
commitf402cc0b5ad889ab474218f518b2362efa7d0f22 (patch)
treeaa665de256b26844992bdd76dbc23131fbd6a3db
parentWIP (diff)
downloadmpdview-f402cc0b5ad889ab474218f518b2362efa7d0f22.tar.gz
mpdview-f402cc0b5ad889ab474218f518b2362efa7d0f22.tar.bz2
mpdview-f402cc0b5ad889ab474218f518b2362efa7d0f22.tar.xz
mpdview-f402cc0b5ad889ab474218f518b2362efa7d0f22.tar.zst
mpdview-f402cc0b5ad889ab474218f518b2362efa7d0f22.zip
WIP
-rw-r--r--src/c_mpdview.c13
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);