summaryrefslogtreecommitdiffstats
path: root/src/c_mpdview.c
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-07-03 03:51:52 +0200
committerJoe <bousset.rudy@gmail.com>2022-07-03 03:51:52 +0200
commit13221e941bcda86bc251c1ce0f90ba7b2f8501a5 (patch)
tree55eaa7a1be550ed72ee2d7aa396456ec79f56374 /src/c_mpdview.c
parentWIP (diff)
downloadmpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.gz
mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.bz2
mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.xz
mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.zst
mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.zip
WIP
Diffstat (limited to 'src/c_mpdview.c')
-rw-r--r--src/c_mpdview.c25
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);