Hi bnilsson,
good idea and easy to implement.
Add this to /var/www/assets/js/runeui.js
- Code: Select all
function timeConvert3(ss) {
var hr = Math.floor(ss/3600);
var mm = Math.floor((ss -(hr * 3600))/60);
ss = Math.floor(ss -(hr*3600) -(mm * 60));
if (hr > 0) {
if (hr < 10){
hr = '0' + hr + 'h ';
}
hr += 'h ';
} else {
hr = '';
}
if (mm < 10) { mm = '0' + mm; }
if (ss < 10) { ss = '0' + ss; }
return hr + mm + 'm ' + ss + 's';
}
and modify this function:
- Code: Select all
// render the playing queue from the data response
function getPlaylistPlain(data) {
var current = parseInt(GUI.json.song) + 1;
var state = GUI.json.state;
var content = '', time = '', artist = '', album = '', title = '', name='', str = '', filename = '', path = '', id = 0, songid = '', bottomline = '', totaltime = 0, playlisttime = 0, pos = 0;
var i, line, lines = data.split('\n'), infos=[];
for (i = 0; (line = lines[i]); i += 1) {
infos = line.split(': ');
if ('Time' === infos[0]) {
time = parseInt(infos[1]);
}
else if ('Artist' === infos[0]) {
artist = infos[1];
}
else if ('Title' === infos[0]) {
title = infos[1];
}
else if ('Name' === infos[0]) {
name = infos[1];
}
else if ('Album' === infos[0]) {
album = infos[1];
}
else if ('file' === infos[0]) {
str = infos[1];
}
else if ('Id' === infos[0]) {
songid = infos[1];
if (title === '' || album === '') {
path = parsePath(str);
filename = str.split('/').pop();
title = filename;
if (artist === '') {
bottomline = 'path: ' + path;
} else {
bottomline = artist;
}
} else {
bottomline = artist + ' - ' + album;
}
if (name !== '') {
title = '<i class="fa fa-microphone"></i>' + name;
bottomline = 'URL: ' + (path === '') ? str : path;
totaltime = '';
} else {
totaltime = '<span>' + timeConvert2(time) + '</span>';
playlisttime += time;
}
pos++;
content += '<li id="pl-' + songid + '"' + (state !== 'stop' && pos === current ? ' class="active"' : '') + '><i class="fa fa-times-circle pl-action" title="Remove song from playlist"></i><span class="sn">' + title + totaltime + '</span><span class="bl">' + bottomline + '</span></li>';
time = ''; artist = ''; album = ''; title = ''; name = '';
}
}
$('.playlist').addClass('hide');
$('#playlist-entries').removeClass('hide');
//$('#playlist-entries').html(content);
var pl_entries = document.getElementById('playlist-entries');
if( pl_entries ){ pl_entries.innerHTML = content; }
$('#pl-filter-results').addClass('hide').html('');
$('#pl-filter').val('');
$('#pl-manage').removeClass('hide');
$('#pl-count').removeClass('hide').html(pos + ((pos !== 1) ? ' entries' : ' entry') + ' ' + timeConvert3(playlisttime) + ' total playtime');
}
I will add this as soon as possible.
Frank