diff options
author | Max Kellermann <max@duempel.org> | 2014-01-18 18:20:54 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-21 21:06:56 +0100 |
commit | 5d4b450c52b3af92a03a8380a40dc703f0df4233 (patch) | |
tree | 9f861173b3861c544670dfb3f38b436902f67b63 /src/Mapper.cxx | |
parent | 483b1f51c96303f2b587870cce6803cc6f699158 (diff) | |
download | mpd-5d4b450c52b3af92a03a8380a40dc703f0df4233.tar.gz mpd-5d4b450c52b3af92a03a8380a40dc703f0df4233.tar.xz mpd-5d4b450c52b3af92a03a8380a40dc703f0df4233.zip |
DetachedSong: add attribute "real_uri"
Prepare for UPnP songs that retain there database identity.
Diffstat (limited to '')
-rw-r--r-- | src/Mapper.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx index 8fafce12d..c9ef4316b 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -26,6 +26,7 @@ #include "Directory.hxx" #include "Song.hxx" #include "DetachedSong.hxx" +#include "LightSong.hxx" #include "fs/AllocatedPath.hxx" #include "fs/Traits.hxx" #include "fs/Charset.hxx" @@ -220,7 +221,15 @@ map_detached_song_fs(const char *uri_utf8) DetachedSong map_song_detach(const LightSong &song) { - return DetachedSong(song); + DetachedSong detached(song); + + if (detached.IsInDatabase()) { + const auto uri = song.GetURI(); + detached.SetRealURI(PathTraitsUTF8::Build(music_dir_utf8.c_str(), + uri.c_str())); + } + + return detached; } AllocatedPath @@ -235,7 +244,7 @@ AllocatedPath map_song_fs(const DetachedSong &song) { if (song.IsAbsoluteFile()) - return AllocatedPath::FromUTF8(song.GetURI()); + return AllocatedPath::FromUTF8(song.GetRealURI()); else return map_uri_fs(song.GetURI()); } |