summaryrefslogtreecommitdiff
path: root/src/Instance.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-29 12:02:14 +0100
committerMax Kellermann <max@musicpd.org>2018-01-30 00:05:57 +0100
commitce2b6dc84d2e62cb4686b052613af383c8f620e1 (patch)
treede2b924d2a671074bb3448baffde6fa57b3e8324 /src/Instance.cxx
parent7d16d8c8871b628244c5110103c7220940092462 (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/Instance.cxx')
-rw-r--r--src/Instance.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Instance.cxx b/src/Instance.cxx
index f87a53be1..2c27b7938 100644
--- a/src/Instance.cxx
+++ b/src/Instance.cxx
@@ -23,6 +23,11 @@
#include "Idle.hxx"
#include "Stats.hxx"
+#ifdef ENABLE_CURL
+#include "RemoteTagCache.hxx"
+#include "util/UriUtil.hxx"
+#endif
+
#ifdef ENABLE_DATABASE
#include "db/DatabaseError.hxx"
@@ -114,3 +119,31 @@ Instance::LostNeighbor(gcc_unused const NeighborInfo &info) noexcept
}
#endif
+
+#ifdef ENABLE_CURL
+
+void
+Instance::LookupRemoteTag(const char *uri) noexcept
+{
+ if (!uri_has_scheme(uri))
+ return;
+
+ if (!remote_tag_cache)
+ remote_tag_cache = std::make_unique<RemoteTagCache>(event_loop,
+ *this);
+
+ remote_tag_cache->Lookup(uri);
+}
+
+void
+Instance::OnRemoteTag(const char *uri, const Tag &tag) noexcept
+{
+ if (!tag.IsDefined())
+ /* boring */
+ return;
+
+ for (auto &partition : partitions)
+ partition.TagModified(uri, tag);
+}
+
+#endif