aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongPrint.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 19:01:06 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 19:09:28 +0100
commitffd16b55a69a01b906805752acc11e26491138bc (patch)
treeeae175525c3691e87c348bc107f903e61302cf69 /src/SongPrint.cxx
parentd744c997d8a4370d56901c5bdf92d3cca0ef83bc (diff)
downloadmpd-ffd16b55a69a01b906805752acc11e26491138bc.tar.gz
mpd-ffd16b55a69a01b906805752acc11e26491138bc.tar.xz
mpd-ffd16b55a69a01b906805752acc11e26491138bc.zip
StoragePlugin: add method MapToRelativeUTF8()
Replaces map_to_relative_path() from Mapper.cxx.
Diffstat (limited to 'src/SongPrint.cxx')
-rw-r--r--src/SongPrint.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx
index b0c9ed0a6..30c248d1e 100644
--- a/src/SongPrint.cxx
+++ b/src/SongPrint.cxx
@@ -20,10 +20,10 @@
#include "config.h"
#include "SongPrint.hxx"
#include "db/LightSong.hxx"
+#include "storage/StorageInterface.hxx"
#include "DetachedSong.hxx"
#include "TimePrint.hxx"
#include "TagPrint.hxx"
-#include "Mapper.hxx"
#include "client/Client.hxx"
#include "util/UriUtil.hxx"
@@ -32,12 +32,20 @@
static void
song_print_uri(Client &client, const char *uri)
{
+#ifdef ENABLE_DATABASE
+ const Storage *storage = client.GetStorage();
+ if (storage != nullptr) {
+ const char *suffix = storage->MapToRelativeUTF8(uri);
+ if (suffix != nullptr)
+ uri = suffix;
+ }
+#endif
+
const std::string allocated = uri_remove_auth(uri);
if (!allocated.empty())
uri = allocated.c_str();
- client_printf(client, "%s%s\n", SONG_FILE,
- map_to_relative_path(uri));
+ client_printf(client, "%s%s\n", SONG_FILE, uri);
}
void