03-02-2019, 10:58 AM
(02-27-2019, 04:16 PM)Tim Curtis Wrote: The web API only accepts MPD commands, vol.sh commands and <script>.sh commands where <script> is a user written script stored in /var/www
Yeah, so I'm looking at ways to trigger what happens when I click on the random button, ie this code in scripts-panels.js:
Code:
$('.btn-toggle').click(function(e) {
var id = $(this).attr('id');
var cmd = id.startsWith('m') ? id.substr(1) : id;
var toggle = $(this).hasClass('btn-primary') ? '0' : '1';
if (cmd == 'random' && SESSION.json['ashufflesvc'] == '1') {
var resp = sendMoodeCmd('GET', 'ashuffle', {'ashuffle':toggle}); // toggle ashuffle on/off
$('random').toggleClass('btn-primary');
$('consume').toggleClass('btn-primary');
sendMpdCmd('consume ' + toggle);
}
else {
$(this).toggleClass('btn-primary');
sendMpdCmd(cmd + ' ' + toggle);
}
One (perhaps the easiest?) approach could be to use puppeteer on my control device to run a headless browser with the Moode playback panel open, and simulate the click when called.