aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/PlaylistQueue.cxx30
-rw-r--r--src/playlist/PlaylistQueue.hxx10
2 files changed, 24 insertions, 16 deletions
diff --git a/src/playlist/PlaylistQueue.cxx b/src/playlist/PlaylistQueue.cxx
index 3c7194ad7..b10a26172 100644
--- a/src/playlist/PlaylistQueue.cxx
+++ b/src/playlist/PlaylistQueue.cxx
@@ -27,16 +27,18 @@
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "fs/Traits.hxx"
+#include "util/Error.hxx"
#ifdef ENABLE_DATABASE
#include "SongLoader.hxx"
#endif
-PlaylistResult
+bool
playlist_load_into_queue(const char *uri, SongEnumerator &e,
unsigned start_index, unsigned end_index,
playlist &dest, PlayerControl &pc,
- const SongLoader &loader)
+ const SongLoader &loader,
+ Error &error)
{
const std::string base_uri = uri != nullptr
? PathTraitsUTF8::GetParent(uri)
@@ -58,20 +60,21 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
continue;
}
- PlaylistResult result = dest.AppendSong(pc, std::move(*song));
+ unsigned id = dest.AppendSong(pc, std::move(*song), error);
delete song;
- if (result != PlaylistResult::SUCCESS)
- return result;
+ if (id == 0)
+ return false;
}
- return PlaylistResult::SUCCESS;
+ return true;
}
-PlaylistResult
+bool
playlist_open_into_queue(const char *uri,
unsigned start_index, unsigned end_index,
playlist &dest, PlayerControl &pc,
- const SongLoader &loader)
+ const SongLoader &loader,
+ Error &error)
{
Mutex mutex;
Cond cond;
@@ -81,13 +84,16 @@ playlist_open_into_queue(const char *uri,
loader.GetStorage(),
#endif
mutex, cond);
- if (playlist == nullptr)
- return PlaylistResult::NO_SUCH_LIST;
+ if (playlist == nullptr) {
+ error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST),
+ "No such playlist");
+ return false;
+ }
- PlaylistResult result =
+ bool result =
playlist_load_into_queue(uri, *playlist,
start_index, end_index,
- dest, pc, loader);
+ dest, pc, loader, error);
delete playlist;
return result;
}
diff --git a/src/playlist/PlaylistQueue.hxx b/src/playlist/PlaylistQueue.hxx
index 48e42c70e..28eb86fcc 100644
--- a/src/playlist/PlaylistQueue.hxx
+++ b/src/playlist/PlaylistQueue.hxx
@@ -26,6 +26,7 @@
#include "PlaylistError.hxx"
+class Error;
class SongLoader;
class SongEnumerator;
struct playlist;
@@ -40,21 +41,22 @@ struct PlayerControl;
* @param start_index the index of the first song
* @param end_index the index of the last song (excluding)
*/
-PlaylistResult
+bool
playlist_load_into_queue(const char *uri, SongEnumerator &e,
unsigned start_index, unsigned end_index,
playlist &dest, PlayerControl &pc,
- const SongLoader &loader);
+ const SongLoader &loader,
+ Error &error);
/**
* Opens a playlist with a playlist plugin and append to the specified
* play queue.
*/
-PlaylistResult
+bool
playlist_open_into_queue(const char *uri,
unsigned start_index, unsigned end_index,
playlist &dest, PlayerControl &pc,
- const SongLoader &loader);
+ const SongLoader &loader, Error &error);
#endif