From 3353715d9e94e4f0e93a00be64010e91891acfa9 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Fri, 1 Jun 2018 00:29:45 +0100 Subject: [PATCH] MPD Version in About Modal --- htdocs/index.html | 1 + htdocs/js/mpd.js | 1 + src/mpd_client.c | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/index.html b/htdocs/index.html index 33a1593..1218352 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -558,6 +558,7 @@
Play Statistics
+ diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index db5feb8..f38079c 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -658,6 +658,7 @@ function webSocketConnect() { var d = new Date(obj.data.dbupdated * 1000); $('#mpdstats_dbupdated').text(d.toUTCString()); $('#mympdVersion').text(obj.data.mympd_version); + $('#mpdVersion').text(obj.data.mpd_version); break; case 'error': showNotification(obj.data,'','','danger'); diff --git a/src/mpd_client.c b/src/mpd_client.c index 4e2816e..0a9548c 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -1071,6 +1071,11 @@ int mympd_get_stats(char *buffer) char *cur = buffer; const char *end = buffer + MAX_SIZE; struct mpd_stats *stats = mpd_run_stats(mpd.conn); + const unsigned *version = mpd_connection_get_server_version(mpd.conn); + char mpd_version[20]; + + snprintf(mpd_version,20,"%i.%i.%i", version[0], version[1], version[2]); + if (stats == NULL) RETURN_ERROR_AND_RECOVER("mympd_get_stats"); cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"mpdstats\",\"data\": {"); @@ -1089,7 +1094,9 @@ int mympd_get_stats(char *buffer) cur += json_emit_raw_str(cur, end - cur, ",\"dbplaytime\":"); cur += json_emit_int(cur, end - cur, mpd_stats_get_db_play_time(stats)); cur += json_emit_raw_str(cur, end - cur, ",\"mympd_version\":"); - cur += json_emit_quoted_str(cur, end - cur, MYMPD_VERSION); + cur += json_emit_quoted_str(cur, end - cur, MYMPD_VERSION); + cur += json_emit_raw_str(cur, end - cur, ",\"mpd_version\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_version); cur += json_emit_raw_str(cur, end - cur, "}}"); mpd_stats_free(stats);
MPD Version
Uptime
Play Time