db/proxy: implement method GetUpdateStamp()
This commit is contained in:
parent
c064e8d62f
commit
d22acc59c9
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@ ver 0.18.5 (20??/??/??)
|
||||||
- fix crash on "stats" without db_file/music_directory
|
- fix crash on "stats" without db_file/music_directory
|
||||||
* database
|
* database
|
||||||
- proxy: auto-reload statistics
|
- proxy: auto-reload statistics
|
||||||
|
- proxy: provide "db_update" in "stats" response
|
||||||
* decoder
|
* decoder
|
||||||
- fluidsynth: auto-detect by default
|
- fluidsynth: auto-detect by default
|
||||||
* fix ia64, mipsel and other little-endian architectures
|
* fix ia64, mipsel and other little-endian architectures
|
||||||
|
|
|
@ -46,6 +46,9 @@ class ProxyDatabase : public Database {
|
||||||
struct mpd_connection *connection;
|
struct mpd_connection *connection;
|
||||||
Directory *root;
|
Directory *root;
|
||||||
|
|
||||||
|
/* this is mutable because GetStats() must be "const" */
|
||||||
|
mutable time_t update_stamp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Database *Create(const config_param ¶m,
|
static Database *Create(const config_param ¶m,
|
||||||
Error &error);
|
Error &error);
|
||||||
|
@ -72,8 +75,7 @@ public:
|
||||||
Error &error) const override;
|
Error &error) const override;
|
||||||
|
|
||||||
virtual time_t GetUpdateStamp() const override {
|
virtual time_t GetUpdateStamp() const override {
|
||||||
// TODO: implement
|
return update_stamp;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -242,6 +244,7 @@ ProxyDatabase::Open(Error &error)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
root = Directory::NewRoot();
|
root = Directory::NewRoot();
|
||||||
|
update_stamp = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -636,6 +639,8 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection,
|
||||||
if (stats2 == nullptr)
|
if (stats2 == nullptr)
|
||||||
return CheckError(connection, error);
|
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.song_count = mpd_stats_get_number_of_songs(stats2);
|
||||||
stats.total_duration = mpd_stats_get_db_play_time(stats2);
|
stats.total_duration = mpd_stats_get_db_play_time(stats2);
|
||||||
stats.artist_count = mpd_stats_get_number_of_artists(stats2);
|
stats.artist_count = mpd_stats_get_number_of_artists(stats2);
|
||||||
|
|
Loading…
Reference in New Issue