PlaylistError: add NotPlaying()
This commit is contained in:
parent
92f54f0b59
commit
f8810d7caf
|
@ -64,6 +64,11 @@ public:
|
||||||
return PlaylistError(PlaylistResult::BAD_RANGE,
|
return PlaylistError(PlaylistResult::BAD_RANGE,
|
||||||
"Bad song index");
|
"Bad song index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PlaylistError NotPlaying() {
|
||||||
|
return PlaylistError(PlaylistResult::NOT_PLAYING,
|
||||||
|
"Not playing");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -260,22 +260,15 @@ playlist::SeekCurrent(PlayerControl &pc,
|
||||||
SignedSongTime seek_time, bool relative,
|
SignedSongTime seek_time, bool relative,
|
||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
if (!playing) {
|
if (!playing)
|
||||||
error.Set(playlist_domain, int(PlaylistResult::NOT_PLAYING),
|
throw PlaylistError::NotPlaying();
|
||||||
"Not playing");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (relative) {
|
if (relative) {
|
||||||
const auto status = pc.LockGetStatus();
|
const auto status = pc.LockGetStatus();
|
||||||
|
|
||||||
if (status.state != PlayerState::PLAY &&
|
if (status.state != PlayerState::PLAY &&
|
||||||
status.state != PlayerState::PAUSE) {
|
status.state != PlayerState::PAUSE)
|
||||||
error.Set(playlist_domain,
|
throw PlaylistError::NotPlaying();
|
||||||
int(PlaylistResult::NOT_PLAYING),
|
|
||||||
"Not playing");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
seek_time += status.elapsed_time;
|
seek_time += status.elapsed_time;
|
||||||
if (seek_time.IsNegative())
|
if (seek_time.IsNegative())
|
||||||
|
|
Loading…
Reference in New Issue