From c32649c131d1b937153685149febd5d01d5b4e27 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Thu, 22 Nov 2018 22:15:25 +0000 Subject: [PATCH] Feat: display libmpdclient version in about dialog --- htdocs/index.html | 1 + htdocs/js/mympd.js | 1 + src/mpd_client.c | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index fc02bdc..9d4af87 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -953,6 +953,7 @@ Play Time
MPD
Protocol Version + Libmpdclient Version diff --git a/htdocs/js/mympd.js b/htdocs/js/mympd.js index e186a5b..057844b 100644 --- a/htdocs/js/mympd.js +++ b/htdocs/js/mympd.js @@ -969,6 +969,7 @@ function parseStats(obj) { document.getElementById('mpdstats_dbUpdated').innerText = d.toUTCString(); document.getElementById('mympdVersion').innerText = obj.data.mympdVersion; document.getElementById('mpdVersion').innerText = obj.data.mpdVersion; + document.getElementById('libmpdclientVersion').innerText = obj.data.libmpdclientVersion; } function toggleBtn(btn, state) { diff --git a/src/mpd_client.c b/src/mpd_client.c index fa80558..7a73424 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -2322,13 +2322,16 @@ int mympd_put_stats(char *buffer) { const unsigned *version = mpd_connection_get_server_version(mpd.conn); int len; char mpd_version[20]; + char libmpdclient_version[20]; struct json_out out = JSON_OUT_BUF(buffer, MAX_SIZE); snprintf(mpd_version, 20, "%i.%i.%i", version[0], version[1], version[2]); - + snprintf(libmpdclient_version, 20, "%i.%i.%i", LIBMPDCLIENT_MAJOR_VERSION, LIBMPDCLIENT_MINOR_VERSION, LIBMPDCLIENT_PATCH_VERSION); + if (stats == NULL) RETURN_ERROR_AND_RECOVER("mympd_put_stats"); len = json_printf(&out, "{type: mpdstats, data: {artists: %d, albums: %d, songs: %d, " - "playtime: %d, uptime: %d, dbUpdated: %d, dbPlaytime: %d, mympdVersion: %Q, mpdVersion: %Q}}", + "playtime: %d, uptime: %d, dbUpdated: %d, dbPlaytime: %d, mympdVersion: %Q, mpdVersion: %Q, " + "libmpdclientVersion: %Q}}", mpd_stats_get_number_of_artists(stats), mpd_stats_get_number_of_albums(stats), mpd_stats_get_number_of_songs(stats), @@ -2337,7 +2340,8 @@ int mympd_put_stats(char *buffer) { mpd_stats_get_db_update_time(stats), mpd_stats_get_db_play_time(stats), MYMPD_VERSION, - mpd_version + mpd_version, + libmpdclient_version ); mpd_stats_free(stats);