diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-29 12:02:14 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-30 00:05:57 +0100 |
commit | ce2b6dc84d2e62cb4686b052613af383c8f620e1 (patch) | |
tree | de2b924d2a671074bb3448baffde6fa57b3e8324 /src/queue | |
parent | 7d16d8c8871b628244c5110103c7220940092462 (diff) |
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.
Diffstat (limited to 'src/queue')
-rw-r--r-- | src/queue/Playlist.cxx | 18 | ||||
-rw-r--r-- | src/queue/Playlist.hxx | 2 |
2 files changed, 20 insertions, 0 deletions
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 /** |