diff options
author | Joe <bousset.rudy@gmail.com> | 2022-07-03 03:51:52 +0200 |
---|---|---|
committer | Joe <bousset.rudy@gmail.com> | 2022-07-03 03:51:52 +0200 |
commit | 13221e941bcda86bc251c1ce0f90ba7b2f8501a5 (patch) | |
tree | 55eaa7a1be550ed72ee2d7aa396456ec79f56374 | |
parent | WIP (diff) | |
download | mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.gz mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.bz2 mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.xz mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.tar.zst mpdview-13221e941bcda86bc251c1ce0f90ba7b2f8501a5.zip |
WIP
-rw-r--r-- | src/c_mpdview.c | 25 | ||||
-rw-r--r-- | src/c_mpdview.h | 3 |
2 files changed, 19 insertions, 9 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); diff --git a/src/c_mpdview.h b/src/c_mpdview.h index ad9338f..21f96b1 100644 --- a/src/c_mpdview.h +++ b/src/c_mpdview.h @@ -39,13 +39,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * mpdview: src/c_mpdview.h - * Mon, 27 Jun 2022 21:20:40 +0200 + * Sun, 03 Jul 2022 03:31:56 +0200 * Joe */ #ifndef __C_MPDVIEW_H__ #define __C_MPDVIEW_H__ +#define BUFF_SIZE 8192 #define PROGNAME "mpdview" typedef char bool_t; |