SongLoader: new class that merges duplicate code

There was quite a lot of duplicate code for loading DetachedSong
objects, with different semantics for "securely" loading local files.
This commit is contained in:
Max Kellermann
2014-02-02 14:37:52 +01:00
parent ba675d6a55
commit ca36ac2ba1
15 changed files with 280 additions and 180 deletions

View File

@@ -25,6 +25,7 @@
#include "PlaylistSave.hxx"
#include "PlaylistFile.hxx"
#include "db/PlaylistVector.hxx"
#include "SongLoader.hxx"
#include "playlist/PlaylistQueue.hxx"
#include "playlist/Print.hxx"
#include "TimePrint.hxx"
@@ -65,11 +66,12 @@ handle_load(Client &client, int argc, char *argv[])
} else if (!check_range(client, &start_index, &end_index, argv[2]))
return CommandResult::ERROR;
const SongLoader loader(client);
const PlaylistResult result =
playlist_open_into_queue(argv[1],
start_index, end_index,
client.playlist,
client.player_control, true);
client.player_control, loader);
if (result != PlaylistResult::NO_SUCH_LIST)
return print_playlist_result(client, result);