From 5d4b450c52b3af92a03a8380a40dc703f0df4233 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 18 Jan 2014 18:20:54 +0100 Subject: DetachedSong: add attribute "real_uri" Prepare for UPnP songs that retain there database identity. --- src/DetachedSong.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/DetachedSong.cxx') diff --git a/src/DetachedSong.cxx b/src/DetachedSong.cxx index 4e52afb0c..83106edee 100644 --- a/src/DetachedSong.cxx +++ b/src/DetachedSong.cxx @@ -32,13 +32,23 @@ DetachedSong::DetachedSong(const LightSong &other) bool DetachedSong::IsRemote() const { - return uri_has_scheme(uri.c_str()); + return uri_has_scheme(GetRealURI()); } bool DetachedSong::IsAbsoluteFile() const { - return PathTraitsUTF8::IsAbsolute(uri.c_str()); + return PathTraitsUTF8::IsAbsolute(GetRealURI()); +} + +bool +DetachedSong::IsInDatabase() const +{ + /* here, we use GetURI() and not GetRealURI() because + GetRealURI() is never relative */ + + const char *_uri = GetURI(); + return !uri_has_scheme(_uri) && !PathTraitsUTF8::IsAbsolute(_uri); } double -- cgit v1.2.3