mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-15 00:35:03 -05:00
[mpd] Send correct value for uptime in 'stats' command
This commit is contained in:
parent
f49a3c888a
commit
a0a6b7d473
15
src/mpd.c
15
src/mpd.c
@ -813,6 +813,9 @@ mpd_command_stats(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
|
|||||||
struct filecount_info fci;
|
struct filecount_info fci;
|
||||||
int artists;
|
int artists;
|
||||||
int albums;
|
int albums;
|
||||||
|
time_t start_time;
|
||||||
|
double uptime;
|
||||||
|
time_t db_update;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
memset(&qp, 0, sizeof(struct query_params));
|
memset(&qp, 0, sizeof(struct query_params));
|
||||||
@ -828,21 +831,25 @@ mpd_command_stats(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
|
|||||||
artists = db_files_get_artist_count();
|
artists = db_files_get_artist_count();
|
||||||
albums = db_files_get_album_count();
|
albums = db_files_get_album_count();
|
||||||
|
|
||||||
//TODO [mpd] Implement missing stats attributes (uptime, playtime)
|
start_time = (time_t) db_admin_getint64(ADMIN_START_TIME);
|
||||||
|
uptime = difftime(time(NULL), start_time);
|
||||||
|
db_update = (time_t) db_admin_getint64(ADMIN_DB_UPDATE);
|
||||||
|
|
||||||
|
//TODO [mpd] Implement missing stats attributes (playtime)
|
||||||
evbuffer_add_printf(evbuf,
|
evbuffer_add_printf(evbuf,
|
||||||
"artists: %d\n"
|
"artists: %d\n"
|
||||||
"albums: %d\n"
|
"albums: %d\n"
|
||||||
"songs: %d\n"
|
"songs: %d\n"
|
||||||
"uptime: %d\n" //in seceonds
|
"uptime: %.f\n" //in seceonds
|
||||||
"db_playtime: %" PRIi64 "\n"
|
"db_playtime: %" PRIi64 "\n"
|
||||||
"db_update: %" PRIi64 "\n"
|
"db_update: %" PRIi64 "\n"
|
||||||
"playtime: %d\n",
|
"playtime: %d\n",
|
||||||
artists,
|
artists,
|
||||||
albums,
|
albums,
|
||||||
fci.count,
|
fci.count,
|
||||||
4,
|
uptime,
|
||||||
(fci.length / 1000),
|
(fci.length / 1000),
|
||||||
(time_t) db_admin_getint64(ADMIN_DB_UPDATE),
|
db_update,
|
||||||
7);
|
7);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user