Restart steam after internet or stream outage

I’m using PiMusicBox for a private stream to cover live events for a radio station. So not only does the box need to start playing the stream immediately, but it needs to restart / persist / recheck and play that stream if it goes down temporarily.

Installed mpc according to these instructions - Radio doesn't return after internet dropout: mpd-watchdog

And ran “mpc repeat on” and PiMusicBox will restart the stream if its broken…except when a reboot occurs the “repeat on” command is gone.
Any ideas how to make this stick?

Thanks for the help

Add mpc repeat on (or whatever) to the autoplay commands at the bottom of /opt/musicbox/

ok. might have put this in the wrong place…

if [ "$INI__musicbox__autoplay" -a "$INI__musicbox__autoplaywait" ]
    log_progress_msg "Waiting $INI__musicbox__autoplaywait seconds before autoplay." "$NAME"
    sleep $INI__musicbox__autoplaywait
    log_progress_msg "Playing $INI__musicbox__autoplay" "$NAME"
    mpc add "$INI__musicbox__autoplay"
    mpc play
    mpc repeat on

Should it be before the “mpc play” command?
because I rebooted my stream server and it won’t reconnect automatically.

What is rebooting here, musicbox or your streaming server?

I added that line to the
Rebooted PiMusicBox. It grabbed the stream and started playing.
I restarted my stream at the server online and the PiMusicBox won’t attemp to re-play it.

Additionally, when I boot PiMusicBox it says “repeat:off”.
“mpc repeat on” must be in the wrong place.


I don’t see why repeat isn’t being enabled there, you should be fine to put any commands you want in that section.

Where and when exactly?

When the Pi boots (HDMI directly into Pi) I have it on a 35 second delay then it starts the autoplay and gives the stream address. After that it says:

[playing] #1/1    0:00/0:00 (0%)
volume: 85%   repeat: off   random: off    single: off   consume: off

MusicBox 0.6

MusicBox login:

When I login as root and type “mpc repeat on”, the statement shown above shows as “repeat: on” and functions the way I need it to.

Got it working! Thanks.