diff --git a/src/mpd.c b/src/mpd.c index 39f17766..193d4c10 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -1146,16 +1146,6 @@ mpd_command_play(struct evbuffer *evbuf, int argc, char **argv, char **errmsg) player_get_status(&status); - //TODO verfiy handling of play with parameter if already playing - if (status.status == PLAY_PLAYING) - { - ret = player_playback_pause(); - if (ret < 0) - { - DPRINTF(E_LOG, L_MPD, "Error pausing playback\n"); - } - } - songpos = 0; if (argc > 1) { @@ -1169,6 +1159,18 @@ mpd_command_play(struct evbuffer *evbuf, int argc, char **argv, char **errmsg) } } + if (status.status == PLAY_PLAYING && songpos < 0) + { + DPRINTF(E_DBG, L_MPD, "Ignoring play command with parameter '%s', player is already playing.\n", argv[1]); + return 0; + } + + if (status.status == PLAY_PLAYING) + { + // Stop playback, if player is already playing and a valid song position is given (it will be restarted for the given song position) + player_playback_stop(); + } + if (songpos > 0) ret = player_playback_start_byindex(songpos, NULL); else