diff options
author | Max Kellermann <max@duempel.org> | 2015-08-11 21:35:52 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-08-11 22:43:10 +0200 |
commit | cbdc3194cc20aa5abcce8b53c44d46a96002ad3a (patch) | |
tree | 04164bedb2ca82200ebcb4f4a01f658a4f79b016 /src/command/PlaylistCommands.cxx | |
parent | 993df0fd289d4426c633fd6e6d12bffe6061599d (diff) | |
download | mpd-cbdc3194cc20aa5abcce8b53c44d46a96002ad3a.tar.gz mpd-cbdc3194cc20aa5abcce8b53c44d46a96002ad3a.tar.xz mpd-cbdc3194cc20aa5abcce8b53c44d46a96002ad3a.zip |
protocol/ArgParser: add struct RangeArg
Diffstat (limited to 'src/command/PlaylistCommands.cxx')
-rw-r--r-- | src/command/PlaylistCommands.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index 516726500..83ac482ea 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -70,12 +70,10 @@ handle_save(Client &client, ConstBuffer<const char *> args) CommandResult handle_load(Client &client, ConstBuffer<const char *> args) { - unsigned start_index, end_index; - - if (args.size < 2) { - start_index = 0; - end_index = unsigned(-1); - } else if (!check_range(client, &start_index, &end_index, args[1])) + RangeArg range; + if (args.size < 2) + range.SetAll(); + else if (!ParseCommandArg(client, range, args[1])) return CommandResult::ERROR; const ScopeBulkEdit bulk_edit(client.partition); @@ -83,7 +81,7 @@ handle_load(Client &client, ConstBuffer<const char *> args) Error error; const SongLoader loader(client); if (!playlist_open_into_queue(args.front(), - start_index, end_index, + range.start, range.end, client.playlist, client.player_control, loader, error)) return print_error(client, error); |