Check if mpd is connected before running/playing
This commit is contained in:
parent
5b5ebb4736
commit
1e9428e2e9
@ -74,6 +74,8 @@ void mpdStop( struct mpd_connection *mpd_connection ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum mpd_state mpdStatus( struct mpd_connection *mpd_connection ) {
|
enum mpd_state mpdStatus( struct mpd_connection *mpd_connection ) {
|
||||||
|
if( mpd_connection == NULL )
|
||||||
|
return -1;
|
||||||
struct mpd_status *status = mpd_run_status( mpd_connection );
|
struct mpd_status *status = mpd_run_status( mpd_connection );
|
||||||
if ( status == NULL )
|
if ( status == NULL )
|
||||||
return -1;
|
return -1;
|
||||||
@ -84,7 +86,7 @@ enum mpd_state mpdStatus( struct mpd_connection *mpd_connection ) {
|
|||||||
|
|
||||||
bool mpdRunning( struct mpd_connection *mpd_connection ) {
|
bool mpdRunning( struct mpd_connection *mpd_connection ) {
|
||||||
enum mpd_state state = mpdStatus( mpd_connection );
|
enum mpd_state state = mpdStatus( mpd_connection );
|
||||||
return state != MPD_STATE_STOP && state != MPD_STATE_UNKNOWN;
|
return state == MPD_STATE_PAUSE || state == MPD_STATE_PLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mpdPlaying( struct mpd_connection *mpd_connection ) {
|
bool mpdPlaying( struct mpd_connection *mpd_connection ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user