Goal: Let Volumio 1.55 automatically start playing music automatically after the Raspberry Pi is powered on. The RPi is used completely headless and without any buttons, and while it is fine that I can control it through my phone or a computer, I sometimes just want to start the music on random play by flicking a plain old power switch and nothing more.
After a lot of fiddling with /etc/rc.local I realized that the NAS is mounted only after my commands in rc.local were executed. A sleep may help, but rc.local is killed if you sleep to long ... argh, nasty!
Instead I decided to hardcode the autoplay into the PHP scripts directly. I don't know any PHP, but how hard can it be?
Edit file /var/www/command/player_wrk.php and search for 'WORKER MAIN LOOP'.
Add the following lines before the '// --- WORKER MAIN LOOP --- //' line:
$cmd = 'amixer cset numid=3 1';
$cmd = 'mpc repeat on';
$cmd = 'mpc random on';
$cmd = 'mpc consume off';
$cmd = 'mpc single off';
$cmd = 'mpc play';
The amixer line tries to force 3.5mm jack audio output. Not sure this works. Omit it if you use your own DAC or HDMI.
Not sure the sleep(5) is necessary. This is actually not specific for NAS and should work with any source. It should play the playlist which was last active.
I would love to have this in the GUI, but I do not know how to hack that in.
Ah yes. Completely unrelated and just so I do not forget it: To get my TL-WN725N WLAN Dongle working with volumio 1.55 I had to download the firmware for it:
sudo wget https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin -O /lib/firmware/rtlwifi/rtl8188eufw.bin