1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-27 11:20:26 +00:00

MPD Version in About Modal

This commit is contained in:
jcorporation 2018-06-01 00:29:45 +01:00
parent b5cfb3512f
commit 3353715d9e
3 changed files with 10 additions and 1 deletions

View File

@ -558,6 +558,7 @@
<h5>Play Statistics</h5>
<table class="table table-sm">
<tbody>
<tr><th>MPD Version</th><td id="mpdVersion"></td></tr>
<tr><th>Uptime</th><td id="mpdstats_uptime"></td></tr>
<tr><th>Play Time</th><td id="mpdstats_playtime"></td></tr>
</tbody>

View File

@ -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');

View File

@ -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);