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

Add queue's total time to panel header.

This commit is contained in:
eb041592 2018-04-04 19:40:12 +02:00
parent 54e334a2a0
commit 0faf70ad05
2 changed files with 17 additions and 4 deletions

View File

@ -81,10 +81,11 @@
<div class="col-md-10 col-xs-12"> <div class="col-md-10 col-xs-12">
<div class="notifications top-right"></div> <div class="notifications top-right"></div>
<div class="panel panel-primary"> <div class="panel panel-primary">
<!-- Default panel contents --> <!-- Default panel contents -->
<div class="panel-heading"><b id="panel-heading">Queue</b></div> <div class="panel-heading"><b id="panel-heading">Queue</b>
<b id="panel-heading-info" class="text pull-right"></b></div>
<div class="panel-body"> <div class="panel-body">
<h1> <h1>
<span id="track-icon" onclick="clickPlay();" class="glyphicon glyphicon-play"></span> <span id="track-icon" onclick="clickPlay();" class="glyphicon glyphicon-play"></span>
@ -218,7 +219,7 @@
<h5>ympd uses following excellent software:</h5> <h5>ympd uses following excellent software:</h5>
<h6><a href="http://cesanta.com/docs.html">Mongoose</a> <small>GPLv2</small></h6> <h6><a href="http://cesanta.com/docs.html">Mongoose</a> <small>GPLv2</small></h6>
<h6><a href="http://www.musicpd.org/libs/libmpdclient/">libMPDClient</a> <small>BSD License</small></h6> <h6><a href="http://www.musicpd.org/libs/libmpdclient/">libMPDClient</a> <small>BSD License</small></h6>
<hr /> <hr />
<div class="row"> <div class="row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<button type="button" class="btn btn-default btn-block" onclick="updateDB();"> <button type="button" class="btn btn-default btn-block" onclick="updateDB();">
@ -296,7 +297,7 @@
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<div class="modal fade" id="savequeue" tabindex="-1" role="dialog" aria-labelledby="savequeueLabel" aria-hidden="true"> <div class="modal fade" id="savequeue" tabindex="-1" role="dialog" aria-labelledby="savequeueLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">

View File

@ -222,6 +222,18 @@ function webSocketConnect() {
if(current_app !== 'queue') if(current_app !== 'queue')
break; break;
if (obj.totalTime > 0) {
var hours = Math.floor(obj.totalTime / 3600);
var minutes = Math.floor(obj.totalTime / 60) - hours * 60;
var seconds = obj.totalTime - hours * 3600 - minutes * 60;
$('#panel-heading-info').text('Total: ' +
(hours > 0 ? hours + '\u2009h ' + (minutes < 10 ? '0' : '') : '') +
minutes + '\u2009m ' + (seconds < 10 ? '0' : '') + seconds + '\u2009s');
} else {
$('#panel-heading-info').empty();
}
$('#salamisandwich > tbody').empty(); $('#salamisandwich > tbody').empty();
for (var song in obj.data) { for (var song in obj.data) {
var minutes = Math.floor(obj.data[song].duration / 60); var minutes = Math.floor(obj.data[song].duration / 60);