The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Random album script
#1
Hi all

I'm trying to beef up my Denon RC-1173 remote with moOde-tied functionality and would like to set a button queuing up a random album, behaving exactly like the random album icon on the playback panel in the web interface. 
As far as I can tell this is the javascript responsible for the functionality but I don't know how to call it as a script that irexec can run. Could anyone shed some light on this?

/www/js/scripts-library.js lines 654-694
Code:
// Random album instant play (button on Playback panel)

$('.ralbum').click(function(e) {

    if ($('.tab-content').hasClass('fancy')) {

        $('.ralbum svg').attr('class', 'spin');

        setTimeout(function() {

            $('.ralbum svg').attr('class', '');

        }, 1500);

    }

    var array = new Uint16Array(1);

    window.crypto.getRandomValues(array);

    pos = Math.floor((array[0] / 65535) * filteredAlbums.length);




    UI.libPos[0] = pos;

    UI.libPos[1] = filteredAlbumCovers.map(function(e) {return e.album;}).indexOf(filteredAlbums[pos].album);

    var albumobj = filteredAlbums[pos];




    storeLibPos(UI.libPos);

    LIB.albumClicked = true; // For renderSongs()




   // Song list for regular album

    clickedLibItem(e, keyAlbum(albumobj), LIB.filters.albums, renderSongs);




    var files = [];

    for (var i in filteredSongs) {

        files.push(filteredSongs[i].file);

    }




   if (SESSION.json['library_instant_play'] == 'Add/Play') {

       mpdDbCmd('playall', files);

   }

   // Clear/play using add first followed by delete. This approach makes for a smoother visual transition.

   else {

       var endpos = $(".playlist li").length

       mpdDbCmd('addall', files);

       setTimeout(function() {

           endpos == 1 ? cmd = 'delplitem&range=0' : cmd = 'delplitem&range=0:' + endpos;

           var result = sendMoodeCmd('GET', cmd, '', true);

           sendMpdCmd('play 0');

       }, 500);

   }

});
Reply


Messages In This Thread
Random album script - by Pieter - 08-10-2019, 01:45 PM
RE: Random album script - by swizzle - 08-10-2019, 08:38 PM
RE: Random album script - by Tim Curtis - 08-10-2019, 10:54 PM
RE: Random album script - by Pieter - 08-30-2019, 11:31 AM
RE: Random album script - by Tim Curtis - 08-30-2019, 12:27 PM

Forum Jump: