diff options
author | Max Kellermann <max@duempel.org> | 2014-05-10 19:02:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-05-10 19:02:33 +0200 |
commit | 0adcda387a276f5fcc24e8a3b9d344a736738a4a (patch) | |
tree | 68edb57f2c03a9f2590111b610749a5184438637 /src | |
parent | fc1664d9fc432c509c236a5889a0a7ead159e3ba (diff) |
PlaylistCommands: remove redundant playlist_load_spl() call
This case is handled already by playlist_open_in_playlist_dir() (via
playlist_mapper_open()). And the call didn't work anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/PlaylistSave.cxx | 29 | ||||
-rw-r--r-- | src/PlaylistSave.hxx | 10 | ||||
-rw-r--r-- | src/command/PlaylistCommands.cxx | 18 |
3 files changed, 1 insertions, 56 deletions
diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx index 78a8fdb91..67f05267f 100644 --- a/src/PlaylistSave.cxx +++ b/src/PlaylistSave.cxx @@ -99,32 +99,3 @@ spl_save_playlist(const char *name_utf8, const playlist &playlist) { return spl_save_queue(name_utf8, playlist.queue); } - -bool -playlist_load_spl(struct playlist &playlist, PlayerControl &pc, - const char *name_utf8, - unsigned start_index, unsigned end_index, - Error &error) -{ - PlaylistFileContents contents = LoadPlaylistFile(name_utf8, error); - if (contents.empty() && error.IsDefined()) - return false; - - if (end_index > contents.size()) - end_index = contents.size(); - - const SongLoader loader(nullptr, nullptr); - Error error2; - - for (unsigned i = start_index; i < end_index; ++i) { - const auto &uri_utf8 = contents[i]; - - unsigned id = playlist.AppendURI(pc, loader, uri_utf8.c_str(), - error2); - if (id == 0) - FormatError(error2, "can't add file \"%s\"", - uri_utf8.c_str()); - } - - return true; -} diff --git a/src/PlaylistSave.hxx b/src/PlaylistSave.hxx index 3e58b8630..914c8c086 100644 --- a/src/PlaylistSave.hxx +++ b/src/PlaylistSave.hxx @@ -48,14 +48,4 @@ spl_save_queue(const char *name_utf8, const Queue &queue); PlaylistResult spl_save_playlist(const char *name_utf8, const playlist &playlist); -/** - * Loads a stored playlist file, and append all songs to the global - * playlist. - */ -bool -playlist_load_spl(struct playlist &playlist, PlayerControl &pc, - const char *name_utf8, - unsigned start_index, unsigned end_index, - Error &error); - #endif diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index bc426db4e..e18673544 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -74,23 +74,7 @@ handle_load(Client &client, int argc, char *argv[]) client.player_control, loader, error)) return print_error(client, error); - if (playlist_load_spl(client.playlist, client.player_control, - argv[1], start_index, end_index, - error)) - return CommandResult::OK; - - if (error.IsDomain(playlist_domain) && - PlaylistResult(error.GetCode()) == PlaylistResult::BAD_NAME) { - /* the message for BAD_NAME is confusing when the - client wants to load a playlist file from the music - directory; patch the Error object to show "no such - playlist" instead */ - Error error2(playlist_domain, int(PlaylistResult::NO_SUCH_LIST), - error.GetMessage()); - error = std::move(error2); - } - - return print_error(client, error); + return CommandResult::OK; } CommandResult |