diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index 5f424b556..5670f401e 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -92,7 +92,7 @@ handle_load(Client &client, Request args, [[maybe_unused]] Response &r) auto &instance = client.GetInstance(); const unsigned new_size = playlist.GetLength(); for (unsigned i = old_size; i < new_size; ++i) - instance.LookupRemoteTag(playlist.queue.Get(i).GetURI()); + instance.LookupRemoteTag(playlist.queue.Get(i).GetRealURI()); return CommandResult::OK; } diff --git a/src/queue/Playlist.cxx b/src/queue/Playlist.cxx index c5d15c780..f4a10b503 100644 --- a/src/queue/Playlist.cxx +++ b/src/queue/Playlist.cxx @@ -44,13 +44,13 @@ playlist::TagModified(DetachedSong &&song) noexcept } void -playlist::TagModified(const char *uri, const Tag &tag) noexcept +playlist::TagModified(const char *real_uri, const Tag &tag) noexcept { bool modified = false; for (unsigned i = 0; i < queue.length; ++i) { auto &song = *queue.items[i].song; - if (song.IsURI(uri)) { + if (song.IsRealURI(real_uri)) { song.SetTag(tag); queue.ModifyAtPosition(i); modified = true; diff --git a/src/queue/Playlist.hxx b/src/queue/Playlist.hxx index e30dc8854..0bbe2916a 100644 --- a/src/queue/Playlist.hxx +++ b/src/queue/Playlist.hxx @@ -196,7 +196,12 @@ public: * the song matches. */ void TagModified(DetachedSong &&song) noexcept; - void TagModified(const char *uri, const Tag &tag) noexcept; + + /** + * @param real_uri the song's "real uri" (see + * DetachedSong::GetRealURI(), DetachedSong::IsRealURI()) + */ + void TagModified(const char *real_uri, const Tag &tag) noexcept; #ifdef ENABLE_DATABASE /** diff --git a/src/song/DetachedSong.hxx b/src/song/DetachedSong.hxx index 908f7f356..810384312 100644 --- a/src/song/DetachedSong.hxx +++ b/src/song/DetachedSong.hxx @@ -162,6 +162,11 @@ public: return uri == other_uri; } + gcc_pure gcc_nonnull_all + bool IsRealURI(const char *other_uri) const noexcept { + return (HasRealURI() ? real_uri : uri) == other_uri; + } + gcc_pure bool IsRemote() const noexcept;