mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-24 18:10:26 +00:00
Display total songs in queue header
This commit is contained in:
parent
71868bf89d
commit
801159bfe8
@ -302,7 +302,7 @@ function webSocketConnect() {
|
||||
var minutes = Math.floor(obj.totalTime / 60) - hours * 60;
|
||||
var seconds = obj.totalTime - hours * 3600 - minutes * 60;
|
||||
|
||||
$('#panel-heading-info').text('Total: ' +
|
||||
$('#panel-heading-info').text(obj.totalSongs+' Songs – ' +
|
||||
(hours > 0 ? hours + '\u2009h ' + (minutes < 10 ? '0' : '') : '') +
|
||||
minutes + '\u2009m ' + (seconds < 10 ? '0' : '') + seconds + '\u2009s');
|
||||
} else {
|
||||
|
@ -628,6 +628,7 @@ int mpd_put_queue(char *buffer, unsigned int offset)
|
||||
const char *end = buffer + MAX_SIZE;
|
||||
struct mpd_entity *entity;
|
||||
unsigned long totalTime = 0;
|
||||
unsigned long totalSongs = 0;
|
||||
|
||||
if (!mpd_send_list_queue_range_meta(mpd.conn, offset, offset+MAX_ELEMENTS_PER_PAGE))
|
||||
RETURN_ERROR_AND_RECOVER("mpd_send_list_queue_meta");
|
||||
@ -663,6 +664,7 @@ int mpd_put_queue(char *buffer, unsigned int offset)
|
||||
cur += json_emit_raw_str(cur, end - cur, "},");
|
||||
|
||||
totalTime += drtn;
|
||||
totalSongs ++;
|
||||
}
|
||||
mpd_entity_free(entity);
|
||||
}
|
||||
@ -672,6 +674,8 @@ int mpd_put_queue(char *buffer, unsigned int offset)
|
||||
|
||||
cur += json_emit_raw_str(cur, end - cur, "],\"totalTime\":");
|
||||
cur += json_emit_int(cur, end - cur, totalTime);
|
||||
cur += json_emit_raw_str(cur, end - cur, ",\"totalSongs\":");
|
||||
cur += json_emit_int(cur, end - cur, totalSongs);
|
||||
cur += json_emit_raw_str(cur, end - cur, "}");
|
||||
return cur - buffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user