mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-25 04:19:15 -05:00
[mpd] Fix mpd command 'play' if player is already playing
While playing issueing command 'play' with a songposition -1 does noting in mpd, with songposition > 0 it starts playback of the song at this position (if this song is already playing, it starts from the beginning).
This commit is contained in:
parent
ed03c90916
commit
9af09c204d
22
src/mpd.c
22
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user