Let the Good Times Roll !
Ici et là, au gré des vents – Daymz.com

Reference thread: http://www.runeaudio.com/forum/post7636.html#p7636

OK, I`ve spent the entire day on this because I just hate the auto-play on boot behavior. I do want the state saved to keep the existing playlist, but in my case, resuming play on boot makes no sense at all (ex: power outage at night – boom, sound system starts blasting music I was listening to some other day)

The fix is in several parts:
1) make sure that the mpdstate file is on « pause » at startup
2) remove a play command in orion_optimize.sh

The following tutorial was done on RuneAudio 0.3 for Raspberry PI.

Part 1 : Change mpdstate before mpd starts

When mpd quits, it saves it states to the state file (/var/lib/mpd/mpdstate). If your device rebooted while it was playing, we will want to have it chagned to pause in order ot avoid mpd restart play.

Create a new script and save it somewhere (example here: /home/user/mpd_state_pause). The script will modify the mpdstate file so that the mpd state is always « paused »

#!/bin/sh

# Modify MPD's state file to ensure current state is "pause"
sed -i 's/^\(state: \).*/\1pause/' /var/lib/mpd/mpdstate

Now, let’s run that script before starting mpd. The best way is to use systemctl’s ExecStartPre directive. Modify /usr/lib/systemd/system/mpd.service to add the ExecStartPre line below: (don’t forget to change the path of the script to the location you chose earlier)

[Unit]
Description=Music Player Daemon
After=network.target sound.target

[Service]
ExecStartPre=/home/user/mpd_state_pause
ExecStart=/usr/bin/mpd --no-daemon

[Install]
WantedBy=multi-user.target

Part 2 : Fix the orion_optimize.sh script

Even though I did Part 1, I could see in the UI that MPD was being restarted, and oh no, play resumed. It took me a freakin’ while, but I eventually found out that /var/www/command/rune_SY_wrk was calling /var/www/command/orion_optimize.sh, and at line 159, that script was calling « mpc play ».

Comment out « mpc play » at line 159.

Part 3 : Test your setup

Go to the RuneAudio web UI, put a couple tunes/web radios in the queue, hit Play. Now reboot the device.

Once rebooted, the queue should still contain all your files, but play will not resume. It will be paused.

Enjoy!

------

Articles similaires

 

Répondre à cet article

Tags HTML autorisés: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>