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
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);
}
});