Requested: Queue total time

Suggestions/requests/ideas for RuneAudio core features and functions

Requested: Queue total time

Postby bnilsson » 21 Aug 2016, 12:04

Hi!

I would like to see a small addition to the RuneUI Queue header.
Now it states the number of entries only.

I would like to see the total playing time for the queue:

e.g. "18 entries, 2hours 36 minutes 56 seconds total"

If this is already implemented in a setting, please let me know.

BN
bnilsson
 
Posts: 23
Joined: 06 Jun 2016, 11:22

Re: Requested: Queue total time

Postby hondagx35 » 21 Aug 2016, 13:42

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
User avatar
hondagx35
 
Posts: 2693
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Requested: Queue total time

Postby bnilsson » 23 Aug 2016, 21:53

Thanks, that was quick!

bnilsson
bnilsson
 
Posts: 23
Joined: 06 Jun 2016, 11:22

Re: Requested: Queue total time

Postby bnilsson » 24 Dec 2016, 10:19

I just downloaded the latest version, and the queue total time feature was not there.
Did you finally decide against it?
bnilsson
 
Posts: 23
Joined: 06 Jun 2016, 11:22

support RuneAudio Donate with PayPal


Return to Feature request

Who is online

Users browsing this forum: No registered users and 1 guest