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

@@ -26,6 +26,7 @@
struct Instance;
class MultipleOutputs;
class SongLoader;
/**
* A partition of the Music Player Daemon. It is a separate unit with
@@ -51,14 +52,10 @@ struct Partition {
playlist.Clear(pc);
}
PlaylistResult AppendFile(const char *path_utf8,
unsigned *added_id=nullptr) {
return playlist.AppendFile(pc, path_utf8, added_id);
}
PlaylistResult AppendURI(const char *uri_utf8,
PlaylistResult AppendURI(const SongLoader &loader,
const char *uri_utf8,
unsigned *added_id=nullptr) {
return playlist.AppendURI(pc, uri_utf8, added_id);
return playlist.AppendURI(pc, loader, uri_utf8, added_id);
}
PlaylistResult DeletePosition(unsigned position) {