1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-08-06 22:14:24 +00:00

Feat: display libmpdclient version in about dialog

This commit is contained in:
jcorporation 2018-11-22 22:15:25 +00:00
parent cf9452b212
commit c32649c131
3 changed files with 9 additions and 3 deletions

View File

@ -953,6 +953,7 @@
<tr><th>Play Time</th><td id="mpdstats_playtime"></td></tr> <tr><th>Play Time</th><td id="mpdstats_playtime"></td></tr>
<tr><td colspan="2" class="pt-3"><h5>MPD</h5></td></tr> <tr><td colspan="2" class="pt-3"><h5>MPD</h5></td></tr>
<tr><th>Protocol Version</th><td id="mpdVersion"></td></tr> <tr><th>Protocol Version</th><td id="mpdVersion"></td></tr>
<tr><th>Libmpdclient Version</th><td id="libmpdclientVersion"></td></tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -969,6 +969,7 @@ function parseStats(obj) {
document.getElementById('mpdstats_dbUpdated').innerText = d.toUTCString(); document.getElementById('mpdstats_dbUpdated').innerText = d.toUTCString();
document.getElementById('mympdVersion').innerText = obj.data.mympdVersion; document.getElementById('mympdVersion').innerText = obj.data.mympdVersion;
document.getElementById('mpdVersion').innerText = obj.data.mpdVersion; document.getElementById('mpdVersion').innerText = obj.data.mpdVersion;
document.getElementById('libmpdclientVersion').innerText = obj.data.libmpdclientVersion;
} }
function toggleBtn(btn, state) { function toggleBtn(btn, state) {

View File

@ -2322,13 +2322,16 @@ int mympd_put_stats(char *buffer) {
const unsigned *version = mpd_connection_get_server_version(mpd.conn); const unsigned *version = mpd_connection_get_server_version(mpd.conn);
int len; int len;
char mpd_version[20]; char mpd_version[20];
char libmpdclient_version[20];
struct json_out out = JSON_OUT_BUF(buffer, MAX_SIZE); struct json_out out = JSON_OUT_BUF(buffer, MAX_SIZE);
snprintf(mpd_version, 20, "%i.%i.%i", version[0], version[1], version[2]); 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) if (stats == NULL)
RETURN_ERROR_AND_RECOVER("mympd_put_stats"); RETURN_ERROR_AND_RECOVER("mympd_put_stats");
len = json_printf(&out, "{type: mpdstats, data: {artists: %d, albums: %d, songs: %d, " 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_artists(stats),
mpd_stats_get_number_of_albums(stats), mpd_stats_get_number_of_albums(stats),
mpd_stats_get_number_of_songs(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_update_time(stats),
mpd_stats_get_db_play_time(stats), mpd_stats_get_db_play_time(stats),
MYMPD_VERSION, MYMPD_VERSION,
mpd_version mpd_version,
libmpdclient_version
); );
mpd_stats_free(stats); mpd_stats_free(stats);