summaryrefslogtreecommitdiff
path: root/src/command/StorageCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-07-06 20:04:35 +0200
committerMax Kellermann <max@musicpd.org>2020-07-06 20:23:41 +0200
commitfe48e5596f9ba0ad93b9995d512b099d324087e3 (patch)
tree5200716c8cbca999969c4890b79043abdcb450e7 /src/command/StorageCommands.cxx
parentd7744d2b8e8219e6f9a9fad7eff63c8e5f3a000d (diff)
command/storage: automatically scan new mounts
Closes https://github.com/MusicPlayerDaemon/MPD/issues/841
Diffstat (limited to 'src/command/StorageCommands.cxx')
-rw-r--r--src/command/StorageCommands.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx
index 2dea85e8d..4d5a58c96 100644
--- a/src/command/StorageCommands.cxx
+++ b/src/command/StorageCommands.cxx
@@ -220,8 +220,10 @@ handle_mount(Client &client, Request args, Response &r)
#ifdef ENABLE_DATABASE
if (auto *db = dynamic_cast<SimpleDatabase *>(instance.GetDatabase())) {
+ bool need_update;
+
try {
- db->Mount(local_uri, remote_uri);
+ need_update = !db->Mount(local_uri, remote_uri);
} catch (...) {
composite.Unmount(local_uri);
throw;
@@ -230,6 +232,12 @@ handle_mount(Client &client, Request args, Response &r)
// TODO: call Instance::OnDatabaseModified()?
// TODO: trigger database update?
instance.EmitIdle(IDLE_DATABASE);
+
+ if (need_update) {
+ UpdateService *update = client.GetInstance().update;
+ if (update != nullptr)
+ update->Enqueue(local_uri, false);
+ }
}
#endif