HACK: Play a track without "add and play". 1 Click playback

I mostly use my Samsung GS4 and iPad to browse the MPD library and often find it frustrating to “add and play” tracks. Especially, considering touch devices do not actually have a “DOUBLE CLICK”, therefore I often have to click the little context menu and press the “add and play” button. It almost kills my flow and interrupts my listening experience.

I understand this is perhaps the default behaviour of MPD but in fairness, having gotten used to Spotify and iTunes I almost expect 1 touch play back without “faffing” around with contextual menus… So… I hacked the file, kinda dirty but it suits me until I find a better solution… This is somewhat of a ‘dirty’ hack that will only work with the webgui (will not work with 3rd party appz)…

Here is how I got the single click to playback by hijacking the 1 click ‘add’ functionality and replacing it with the ‘add and play’ function.

LETS Hack the play button :ugeek: :smiling_imp:

make a backup of this file first

cp /var/www/js/scripts-playback.js /var/www/js/scripts-playback.js.orig

Open the file in Nano (use your favourite editor if you dont know how to use nano)

nano /var/www/js/scripts-playback.js

This will open up the scripts-playback.js file for editing.

Search the file
press CTRL + W (to search the file)
in the search field, type “click on ADD button” (without the quotes)
Press Enter

Replace THIS CODE

    // click on ADD button
    $('.database').on('click', '.db-action', function() {
        var path = $(this).parent().attr('data-path');
        GUI.DBentry[0] = path;
        // console.log('getDB path = ', GUI.DBentry);
    });

with THIS CODE

    // click on ADD button
    $('.database').on('click', '.db-song', function() {
        $('.database li').removeClass('active');
        $(this).parent().addClass('active');
        var path = $(this).parent().data('path');
        //console.log('doubleclicked path = ', path);
        getDB('addplay', path);
        notify('add', path);
    });

Save the file and Exit Nano

press CTRL + O press Enter press CTRL + Q

Back in your browser, Force refresh the Volumio Player page…

Click ONCE on any track :smiley: :smiley: