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 "SongPrint.hxx"
#include "input/InputStream.hxx"
#include "DetachedSong.hxx"
#include "SongLoader.hxx"
#include "fs/Traits.hxx"
#include "thread/Cond.hxx"
@@ -36,10 +37,12 @@ playlist_provider_print(Client &client, const char *uri,
? PathTraitsUTF8::GetParent(uri)
: std::string(".");
const SongLoader loader(client);
DetachedSong *song;
while ((song = e.NextSong()) != nullptr) {
if (playlist_check_translate_song(*song, base_uri.c_str(),
false)) {
loader)) {
if (detail)
song_print_info(client, *song);
else