From ce2b6dc84d2e62cb4686b052613af383c8f620e1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 29 Jan 2018 12:02:14 +0100 Subject: RemoteTagCache: new glue class for integrating RemoteTagScanner This commit also puts an instance of RemoteTagScanner into the Instance class, and hooks it into the "add" and "addid" commands. --- src/queue/Playlist.cxx | 18 ++++++++++++++++++ src/queue/Playlist.hxx | 2 ++ 2 files changed, 20 insertions(+) (limited to 'src/queue') diff --git a/src/queue/Playlist.cxx b/src/queue/Playlist.cxx index 0b68f0298..aaed7190a 100644 --- a/src/queue/Playlist.cxx +++ b/src/queue/Playlist.cxx @@ -43,6 +43,24 @@ playlist::TagModified(DetachedSong &&song) OnModified(); } +void +playlist::TagModified(const char *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)) { + song.SetTag(tag); + queue.ModifyAtPosition(i); + modified = true; + } + } + + if (modified) + OnModified(); +} + inline void playlist::QueueSongOrder(PlayerControl &pc, unsigned order) diff --git a/src/queue/Playlist.hxx b/src/queue/Playlist.hxx index d2b7937d3..499481360 100644 --- a/src/queue/Playlist.hxx +++ b/src/queue/Playlist.hxx @@ -23,6 +23,7 @@ #include "queue/Queue.hxx" enum TagType : uint8_t; +struct Tag; struct PlayerControl; class DetachedSong; class Database; @@ -192,6 +193,7 @@ public: * the song matches. */ void TagModified(DetachedSong &&song); + void TagModified(const char *uri, const Tag &tag) noexcept; #ifdef ENABLE_DATABASE /** -- cgit v1.2.3