Page 1 of 1

Radio Stream Selection

PostPosted: 28 Sep 2017, 18:54
by andfor
Hi

It might just be me, but I find it annoying that Rune adds radio streams to the end of the queue when you double-click on a station in the library.

Switching between stations means that I often end up with a long list with the same station listed several times.

I think it would be better if, for radio stations only, a double-click means 'Add Replace and Play' rather than just 'Add'. That way you could switch stations easily without creating a long list in the queue.

Obviously I wouldn't want this behaviour to apply to choosing music from the attached music library.

Maybe this would be more complicated to achieve than I realise, but some help with how to achieve this by editing the code would be appreciated if at all possible without breaking the whole thing!

Thanks

Re: Radio Stream Selection

PostPosted: 28 Sep 2017, 22:10
by hondagx35
Hi ,

you have to edit /srv/http/assets/js/runeui.js
from:
Code: Select all
        // double click on Library list entry
        db.on('dblclick', 'li', function(e) {
            var el = $(this);
            if (!$(e.target).hasClass('db-action')) {
                $('li.active', '#database-entries').removeClass('active');
                el.addClass('active');
                var path = el.data('path');
                // console.log('doubleclicked path = ', path);
                if (el.hasClass('db-spotify')) {
                    path = el.attr('data-plid') + '-' + el.attr('data-path');
                    getDB({
                        cmd: 'spaddplay',
                        path: path,
                        querytype: 'spotify-track'
                    });
      } else {
                    path = (el.hasClass('db-dirble')) ? path.split(' | ')[1] : path;
                    getDB({
                        cmd: 'addplay',
                        path: path
                    });
                }
            }
        });

to:
Code: Select all
        // double click on Library list entry
        db.on('dblclick', 'li', function(e) {
            var el = $(this);
            if (!$(e.target).hasClass('db-action')) {
                $('li.active', '#database-entries').removeClass('active');
                el.addClass('active');
                var path = el.data('path');
                // console.log('doubleclicked path = ', path);
                if (el.hasClass('db-spotify')) {
                    path = el.attr('data-plid') + '-' + el.attr('data-path');
                    getDB({
                        cmd: 'spaddplay',
                        path: path,
                        querytype: 'spotify-track'
                    });
                } else if (path.startsWith('Webradio')){
                    getDB({
                        cmd: 'addreplaceplay',
                        path: path
                    });
            } else {
                    path = (el.hasClass('db-dirble')) ? path.split(' | ')[1] : path;
                    getDB({
                        cmd: 'addplay',
                        path: path
                    });
                }
            }
        });

This also has to be minified (runeui.min.js) or you have to switch to dev mode.

Frank

Re: Radio Stream Selection

PostPosted: 30 Sep 2017, 09:41
by andfor
Hi Frank,

Thanks that worked great.

This might be greedy of me, but is there a way to do this with a single click? I've tried adding the code you gave me to the library browsing code above the section you altered in various places, but I'm not savvy enough to know what I'm doing really.

Think of all the time I could save by only clicking once! :D That's a huge increase in UI efficiency.

Thanks again.

Re: Radio Stream Selection

PostPosted: 30 Sep 2017, 10:52
by hondagx35
Hi,

try:
Code: Select all
                } else if (el.hasClass('db-webradio-add')) {
                    $('#modal-webradio-add').modal();
                }
            }
        });


Code: Select all
                } else if (el.hasClass('db-webradio-add')) {
                    $('#modal-webradio-add').modal();
                } else {
                    path = el.data('path');
                   if (path.startsWith('Webradio')){
                       getDB({
                            cmd: 'addreplaceplay',
                            path: path
                        });
                    }
                }
            }
        });


Frank

Re: Radio Stream Selection

PostPosted: 01 Oct 2017, 09:45
by andfor
Thanks Frank!

That works.