jump to current song at startup even if it's not currently played

This commit is contained in:
Andrzej Rybczak
2012-07-13 23:23:44 +02:00
parent f96b4fc776
commit a14b77338d
6 changed files with 21 additions and 14 deletions

View File

@@ -519,12 +519,12 @@ void MPD::Connection::Seek(unsigned where)
if (!isCommandsListEnabled)
{
GoBusy();
mpd_run_seek_pos(itsConnection, Mpd.GetCurrentSongPos(), where);
mpd_run_seek_pos(itsConnection, Mpd.GetCurrentlyPlayingSongPos(), where);
}
else
{
assert(!isIdle);
mpd_send_seek_pos(itsConnection, Mpd.GetCurrentSongPos(), where);
mpd_send_seek_pos(itsConnection, Mpd.GetCurrentlyPlayingSongPos(), where);
}
}
@@ -657,10 +657,15 @@ MPD::Song MPD::Connection::GetSong(const std::string &path)
int MPD::Connection::GetCurrentSongPos() const
{
return itsCurrentStatus && isPlaying() ? mpd_status_get_song_pos(itsCurrentStatus) : -1;
return itsCurrentStatus ? mpd_status_get_song_pos(itsCurrentStatus) : -1;
}
MPD::Song MPD::Connection::GetCurrentSong()
int MPD::Connection::GetCurrentlyPlayingSongPos() const
{
return isPlaying() ? GetCurrentSongPos() : -1;
}
MPD::Song MPD::Connection::GetCurrentlyPlayingSong()
{
assert(!isCommandsListEnabled);
GoBusy();