Volumio Play Here "Original" Button Modification


This script enables the original volumio "Play Here" button to function as expected and removes the Purchase Subscription message. Volumio Ver3. Tested  On :- PI , Rock 3a and Odroid C2

Labtools Pluggin must installed and enabled for this to function. "The Pill" Play button is not visible with this
script.

Appearence and function is like a standard Volumio UI.

 

nano ~/patch-playhere.sh

enter code:---------------------------

 

#!/bin/bash
# Make the Volumio Manifest UI (www4) phone/"Play here" button press the
# Labs tools "Play here" pill (#labtools-playhere) instead of opening the
# subscribe prompt. If the pill isn't on the page, Volumio's normal
# behaviour is kept.
#
# Usage: sudo ./patch-playhere.sh # apply
# sudo ./patch-playhere.sh --restore # put the original back
#
# Safe to re-run: it always patches from a pristine .orig copy of the bundle.

set -e
WWW=/volumio/http/www4
APP=$(grep -o 'scripts/app-[a-z0-9]*\.js' "$WWW/index.html" | head -1)
JS="$WWW/$APP"
ORIG="$JS.orig"

[ -f "$JS" ] || { echo "Live bundle not found: $JS"; exit 1; }
[ -f "$ORIG" ] || cp "$JS" "$ORIG" # first run: keep the untouched original

cp "$ORIG" "$JS" # start clean every time

if [ "$1" = "--restore" ]; then
echo "Restored original $APP"
exit 0
fi

node - "$JS" <<'EOF'
const fs = require('fs');
const file = process.argv[2];
let s = fs.readFileSync(file, 'utf8');

// 1) Button presses the Labs tools pill first; original code runs only if no pill
const fnHead = '{key:"toggleLocalPlayback",value:function(){';
const at1 = s.indexOf(fnHead);
if (at1 < 0) { console.error('toggleLocalPlayback not found - bundle differs, aborting.'); process.exit(1); }
const hook = 'var p=document.getElementById("labtools-playhere");if(p){p.click();return}';
s = s.slice(0, at1 + fnHead.length) + hook + s.slice(at1 + fnHead.length);

// 2) Don't grey the button out
const btn = s.indexOf('id="outputButton"');
const dis = "\\'toggle-button__disabled\\': !audioOutputs.hasLocalPlayback()";
const at2 = s.indexOf(dis, btn);
if (btn >= 0 && at2 >= 0) {
s = s.slice(0, at2) + "\\'toggle-button__disabled\\': false" + s.slice(at2 + dis.length);
} else {
console.warn('Note: disabled-state condition not found; button may still look greyed out.');
}

// 3) Hide the floating pill (it stays on the page, so the button can still click it)
s = '(function(){var st=document.createElement("style");st.textContent="#labtools-playhere{display:none!important}";(document.head||document.documentElement).appendChild(st)})();\n' + s;

fs.writeFileSync(file, s);
console.log('Patched: phone button now presses the Labs tools Play here pill (pill hidden).');
EOF

# Keep a pre-compressed copy in sync if one exists
[ -f "$JS.gz" ] && gzip -kf "$JS" && echo "Refreshed $APP.gz"

echo "Done. Hard-refresh the Volumio page (Ctrl+Shift+R) to load it."

 

 

------------------------------------------------------------------------------

 

 

 


# clear with Ctrl+K, paste new, Ctrl+O, Enter, Ctrl+X

Next two cammands

chmod +x ~/patch-playhere.sh

sudo ~/patch-playhere.sh

 

refresh volumio ctrl + shift + R


Labtools must be loaded / activated

to restore original

sudo ~/patch-playhere.sh --restore

 

  • Volumio, Volumio Music Player, Volumio Play Here, Volumio Play here Raspberry PI, Volumio Play here Rock 3a, Volumio Streaming HTTP Server, Volumio Play Here Button
  • 0 utilizatori au considerat informaţia utilă
Răspunsul a fost util?

Related Articles

Volumio for Rock 3A

Volumio Music Player for the Rock 3A Rockchip RK3568 Quad-core 64 bit Cortex-A55 processor,...

Volumio Music Stream Function Rock 3A

The Volumio "Play Here" function which allows music to be played directly to your controlling pc...

Volumio Music Stream Function Raspberry PI4

The Volumio "Play Here" function which allows music to be played directly to your controlling pc...

Volumio Icecast Integration Guide: Creating a Continuous Network Audio Stream

Learn how to configure Volumio's MPD Shout output and Icecast2 on a Raspberry Pi 4 to create a...

Volumio - Icecast persistent streaming Guide Workflow

Volumio Pi 4 - Persistent Icecast Streaming Guide Documenting the working configuration created...