Skip to content

Commit

Permalink
Central beautify Duration function
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed May 27, 2018
1 parent 1da825c commit cb8a07a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions htdocs/js/mpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,7 @@ function webSocketConnect() {
$('#panel-heading-queue').text(obj.totalSongs+' Songs');
}
if (typeof(obj.totalTime) != undefined && obj.totalTime > 0 ) {
var days = Math.floor(obj.totalTime / 86400);
var hours = Math.floor(obj.totalTime / 3600) - days * 24;
var minutes = Math.floor(obj.totalTime / 60) - hours * 60 - days * 1440;
var seconds = obj.totalTime - days * 86400 - hours * 3600 - minutes * 60;

$('#panel-heading-queue').append(' – ' +
(days > 0 ? days + '\u2009d ' : '') +
(hours > 0 ? hours + '\u2009h ' + (minutes < 10 ? '0' : '') : '') +
minutes + '\u2009m ' + (seconds < 10 ? '0' : '') + seconds + '\u2009s');
$('#panel-heading-queue').append(' – ' + beautifyDuration(obj.totalTime));
}

$('#queueList > tbody').empty();
Expand Down

0 comments on commit cb8a07a

Please sign in to comment.