aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-06 22:10:25 +0200
committerMax Kellermann <max@duempel.org>2015-08-12 08:41:05 +0200
commit7652a2986b0d0ad55b2776685130f1c68d7108c7 (patch)
treeb4d45e60e97757454f1ff8e4dc793a1e7d852c36 /src/playlist
parentb1480167be487d09ff46bb86ad02041fb28acff1 (diff)
downloadmpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.tar.gz
mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.tar.xz
mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.zip
client/Response: new Client wrapper class for writing responses
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/Print.cxx21
-rw-r--r--src/playlist/Print.hxx9
2 files changed, 18 insertions, 12 deletions
diff --git a/src/playlist/Print.cxx b/src/playlist/Print.cxx
index 3de9807b7..13e45d160 100644
--- a/src/playlist/Print.cxx
+++ b/src/playlist/Print.cxx
@@ -28,48 +28,51 @@
#include "fs/Traits.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
-#include "client/Client.hxx"
+#include "Partition.hxx"
+#include "Instance.hxx"
static void
-playlist_provider_print(Client &client, const char *uri,
+playlist_provider_print(Response &r, Partition &partition,
+ const SongLoader &loader,
+ const char *uri,
SongEnumerator &e, bool detail)
{
const std::string base_uri = uri != nullptr
? 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(),
loader) &&
detail)
- song_print_info(client, *song);
+ song_print_info(r, partition, *song);
else
/* fallback if no detail was requested or no
detail was available */
- song_print_uri(client, *song);
+ song_print_uri(r, partition, *song);
delete song;
}
}
bool
-playlist_file_print(Client &client, const char *uri, bool detail)
+playlist_file_print(Response &r, Partition &partition,
+ const SongLoader &loader,
+ const char *uri, bool detail)
{
Mutex mutex;
Cond cond;
SongEnumerator *playlist = playlist_open_any(uri,
#ifdef ENABLE_DATABASE
- client.GetStorage(),
+ partition.instance.storage,
#endif
mutex, cond);
if (playlist == nullptr)
return false;
- playlist_provider_print(client, uri, *playlist, detail);
+ playlist_provider_print(r, partition, loader, uri, *playlist, detail);
delete playlist;
return true;
}
diff --git a/src/playlist/Print.hxx b/src/playlist/Print.hxx
index 02096bdc2..3b356d4ce 100644
--- a/src/playlist/Print.hxx
+++ b/src/playlist/Print.hxx
@@ -20,17 +20,20 @@
#ifndef MPD_PLAYLIST__PRINT_HXX
#define MPD_PLAYLIST__PRINT_HXX
-class Client;
+class Response;
+class SongLoader;
+struct Partition;
/**
* Send the playlist file to the client.
*
- * @param client the client which requested the playlist
* @param uri the URI of the playlist file in UTF-8 encoding
* @param detail true if all details should be printed
* @return true on success, false if the playlist does not exist
*/
bool
-playlist_file_print(Client &client, const char *uri, bool detail);
+playlist_file_print(Response &r, Partition &partition,
+ const SongLoader &loader,
+ const char *uri, bool detail);
#endif