diff --git a/src/DetachedSong.cxx b/src/DetachedSong.cxx index da5d0f629..6ed08cd14 100644 --- a/src/DetachedSong.cxx +++ b/src/DetachedSong.cxx @@ -31,6 +31,19 @@ DetachedSong::DetachedSong(const LightSong &other) start_time(other.start_time), end_time(other.end_time) {} +DetachedSong::operator LightSong() const +{ + LightSong result; + result.directory = nullptr; + result.uri = uri.c_str(); + result.real_uri = real_uri.empty() ? nullptr : real_uri.c_str(); + result.tag = &tag; + result.mtime = mtime; + result.start_time = start_time; + result.end_time = end_time; + return result; +} + bool DetachedSong::IsRemote() const { diff --git a/src/DetachedSong.hxx b/src/DetachedSong.hxx index 2197d0d43..fc8d7c4e6 100644 --- a/src/DetachedSong.hxx +++ b/src/DetachedSong.hxx @@ -107,6 +107,9 @@ public: DetachedSong(DetachedSong &&) = default; DetachedSong &operator=(DetachedSong &&) = default; + gcc_pure + explicit operator LightSong() const; + gcc_pure const char *GetURI() const { return uri.c_str();