diff options
| author | Joe <bousset.rudy@gmail.com> | 2022-07-14 15:16:01 +0200 | 
|---|---|---|
| committer | Joe <bousset.rudy@gmail.com> | 2022-07-14 15:16:01 +0200 | 
| commit | e3f30c58b09640e3bc7f4aa133e82ee7a0cb0db9 (patch) | |
| tree | b34ddf09e432849f5eec6199e0e8cd3c0d977a50 /src | |
| parent | update (diff) | |
| download | mpdview-e3f30c58b09640e3bc7f4aa133e82ee7a0cb0db9.tar.gz mpdview-e3f30c58b09640e3bc7f4aa133e82ee7a0cb0db9.tar.bz2 mpdview-e3f30c58b09640e3bc7f4aa133e82ee7a0cb0db9.tar.xz mpdview-e3f30c58b09640e3bc7f4aa133e82ee7a0cb0db9.tar.zst mpdview-e3f30c58b09640e3bc7f4aa133e82ee7a0cb0db9.zip | |
WIP
Diffstat (limited to '')
| -rw-r--r-- | src/c_mpdview.c | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/src/c_mpdview.c b/src/c_mpdview.c index 77d1eec..320f8e2 100644 --- a/src/c_mpdview.c +++ b/src/c_mpdview.c @@ -45,6 +45,8 @@   * This is the entrypoint of the program.   */ +#include <mpd/song.h> +#include <mpd/status.h>  #include <sys/param.h>  #include <sys/syslimits.h> @@ -143,6 +145,10 @@ c_get_mpd_status(struct mpdview_s* v)  static u8_t  c_get_mpd_song(struct mpdview_s* v)  { +	if (v->song != NULL) { +		mpd_song_free(v->song); +		v->song = NULL; +	}  	v->song = mpd_run_current_song(v->conn);  	if (v->song == NULL) {  		dprintf( @@ -220,11 +226,11 @@ main  		c_destroy_mpdview(&view);  		return (EXIT_FAILURE);  	} +	signal(SIGINT, c_signal);  	if (c_get_mpd_status(view) == RET_ERR) {  		c_destroy_mpdview(&view);  		return (EXIT_FAILURE);  	} -	signal(SIGINT, c_signal);  	if (view->state == MPD_STATE_PLAY || view->state == MPD_STATE_PAUSE) {  		if (c_get_mpd_song(view) == RET_ERR) {  			c_destroy_mpdview(&view); @@ -239,6 +245,10 @@ main  		doexit == FALSE &&  		mpd_run_idle_mask(view->conn, MPD_IDLE_PLAYER) != 0  		) { +		if (c_get_mpd_status(view) == RET_ERR) { +			c_destroy_mpdview(&view); +			return (EXIT_FAILURE); +		}  		if (view->state == MPD_STATE_PLAY || view->state == MPD_STATE_PAUSE) {  			if (c_get_mpd_song(view) == RET_ERR) {  				c_destroy_mpdview(&view); | 
