queue/Playlist: seek methods return bool/Error instead of PlaylistResult

This commit is contained in:
Max Kellermann
2015-11-11 19:32:32 +01:00
parent 0f4f04eaa4
commit 5e93c05095
5 changed files with 78 additions and 48 deletions

View File

@@ -296,9 +296,10 @@ handle_seek(Client &client, Request args, Response &r)
if (!args.Parse(0, song, r) || !args.Parse(1, seek_time, r))
return CommandResult::ERROR;
PlaylistResult result =
client.partition.SeekSongPosition(song, seek_time);
return print_playlist_result(r, result);
Error error;
return client.partition.SeekSongPosition(song, seek_time, error)
? CommandResult::OK
: print_error(r, error);
}
CommandResult
@@ -311,9 +312,10 @@ handle_seekid(Client &client, Request args, Response &r)
if (!args.Parse(1, seek_time, r))
return CommandResult::ERROR;
PlaylistResult result =
client.partition.SeekSongId(id, seek_time);
return print_playlist_result(r, result);
Error error;
return client.partition.SeekSongId(id, seek_time, error)
? CommandResult::OK
: print_error(r, error);
}
CommandResult
@@ -325,9 +327,10 @@ handle_seekcur(Client &client, Request args, Response &r)
if (!ParseCommandArg(r, seek_time, p))
return CommandResult::ERROR;
PlaylistResult result =
client.partition.SeekCurrent(seek_time, relative);
return print_playlist_result(r, result);
Error error;
return client.partition.SeekCurrent(seek_time, relative, error)
? CommandResult::OK
: print_error(r, error);
}
CommandResult