diff options
author | Max Kellermann <max@duempel.org> | 2013-11-23 18:45:02 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-11-23 18:45:02 +0100 |
commit | 99527051b5751d2ef7c6b593f1beda84d1bcc33f (patch) | |
tree | 39b08616c597fc173022164050ed557650c177b5 /src/db | |
parent | bed98303a346dd98e2a239579c032d170440441d (diff) | |
parent | 57e0cc54424561499039967aa501c17d4b179019 (diff) | |
download | mpd-99527051b5751d2ef7c6b593f1beda84d1bcc33f.tar.gz mpd-99527051b5751d2ef7c6b593f1beda84d1bcc33f.tar.xz mpd-99527051b5751d2ef7c6b593f1beda84d1bcc33f.zip |
Merge branch 'v0.18.x'
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/ProxyDatabasePlugin.cxx | 10 | ||||
-rw-r--r-- | src/db/SimpleDatabasePlugin.hxx | 11 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx index fc99242ee..00b5d445f 100644 --- a/src/db/ProxyDatabasePlugin.cxx +++ b/src/db/ProxyDatabasePlugin.cxx @@ -46,6 +46,9 @@ class ProxyDatabase : public Database { struct mpd_connection *connection; Directory *root; + /* this is mutable because GetStats() must be "const" */ + mutable time_t update_stamp; + public: static Database *Create(const config_param ¶m, Error &error); @@ -71,6 +74,10 @@ public: DatabaseStats &stats, Error &error) const override; + virtual time_t GetUpdateStamp() const override { + return update_stamp; + } + private: bool Configure(const config_param ¶m, Error &error); @@ -237,6 +244,7 @@ ProxyDatabase::Open(Error &error) return false; root = Directory::NewRoot(); + update_stamp = 0; return true; } @@ -631,6 +639,8 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection, if (stats2 == nullptr) return CheckError(connection, error); + update_stamp = (time_t)mpd_stats_get_db_update_time(stats2); + stats.song_count = mpd_stats_get_number_of_songs(stats2); stats.total_duration = mpd_stats_get_db_play_time(stats2); stats.artist_count = mpd_stats_get_number_of_artists(stats2); diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx index 24e150a97..dfe981dd8 100644 --- a/src/db/SimpleDatabasePlugin.hxx +++ b/src/db/SimpleDatabasePlugin.hxx @@ -26,8 +26,6 @@ #include <cassert> -#include <time.h> - struct Directory; class SimpleDatabase : public Database { @@ -55,11 +53,6 @@ public: bool Save(Error &error); - gcc_pure - time_t GetLastModified() const { - return mtime; - } - static Database *Create(const config_param ¶m, Error &error); @@ -85,6 +78,10 @@ public: DatabaseStats &stats, Error &error) const override; + virtual time_t GetUpdateStamp() const override { + return mtime; + } + protected: bool Configure(const config_param ¶m, Error &error); |