db/proxy: implement Update()

This commit is contained in:
Max Kellermann 2014-07-29 23:16:46 +02:00
parent aa0f06d6b7
commit 12b5494906
2 changed files with 20 additions and 0 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ ver 0.19 (not yet released)
- "list" and "count" allow grouping
* database
- proxy: forward "idle" events
- proxy: forward the "update" command
- proxy: copy "Last-Modified" from remote directories
- upnp: new plugin
- cancel the update on shutdown

View File

@ -120,6 +120,9 @@ public:
DatabaseStats &stats,
Error &error) const override;
virtual unsigned Update(const char *uri_utf8, bool discard,
Error &error) override;
virtual time_t GetUpdateStamp() const override {
return update_stamp;
}
@ -809,6 +812,22 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection,
return true;
}
unsigned
ProxyDatabase::Update(const char *uri_utf8, bool discard,
Error &error)
{
if (!EnsureConnected(error))
return 0;
unsigned id = discard
? mpd_run_rescan(connection, uri_utf8)
: mpd_run_update(connection, uri_utf8);
if (id == 0)
CheckError(connection, error);
return id;
}
const DatabasePlugin proxy_db_plugin = {
"proxy",
DatabasePlugin::FLAG_REQUIRE_STORAGE,