Autoplay All Tracks random and repeat

Hello, is there a way to make a entry in the settings Autoplay URI that play all mp3 files on the SD Card with random and repeat in Autostart?

Thanks from Austria!!!

Hi i find this, but I do not know where the file startup.sh is located I use the musicbox_v0.7.0RC4

Upon reboot I have pi Musicbox set to scan for new music. Then I edited the startup.sh so rather than adding the single song to play I have something like this:
mpc ls “Local media/Tracks” |mpc add
mpc random on
mpc repeat on
mpc play

Version 0.5.4 pi musicbox

Maybe there is a more elegant way to make that happen.

sudo nano /opt/musicbox/startup.sh

I can not make it, someone knows how it goes, step by step

The location of that file has not changed. Your own step by step instructions are still 100% valid.

Hi kingosticks, to be fair I have tried using the info that Bernhard found and including it in startup.sh and I could not get it to work.
It works fine as a bash script and entered into the terminal it also works, but no matter what I tried it would not work in the startup.sh.
I haven’t looked at it for a few weeks as it’s been a while since Bernhard asked the original query and I thought he may have found an alternative method.

Ok, cheers for the follow up, I’ll try them and see what’s going wrong. Presumably there’s an error message in the log. It certainly wasn’t supposed to have changed!

Well there you go - after messing about with it this morning works fine now. I think I was probably overthinking it before.
I commented out the existing mpc add and mpc play but I guess they could be removed completely.
Better get back and do some actual work now!! Good luck Bernhard

   if [ $waittime -le $INI__musicbox__autoplaymaxwait ]
    then
        echo "Mopidy startup complete, playing $INI__musicbox__autoplay"
        mpc ls "Local media/Tracks" |mpc add
            mpc random on
    mpc repeat on
    mpc play

#mpc add “$INI__musicbox__autoplay”

mpc play

1 Like

Hi Bernhard, I think I can see why you are having problems.

I have started with a fresh copy of Musicbox

You need to select a track for autoplay after first boot up in "Settings-Musicbox-Autoplay URI on the Web interface
Reboot and the selected track should play.
Go back to Settings-Musicbox-Autoplay URI and remove the song.

SSH in and go to sudo nano /opt/musicbox/startup.sh go down almost to bottom and make the changes listed in previous post. (I would save a back up of startup.sh first)

Reboot and it should start playing your tracks.

It appears that once you have selected a track in autoplay the system keeps on recognising that part of the bootup process - else it seems to ignore it. After the first time you can make changes to startup.sh as you wish.
Hope this helps.

Hello Thanks you are all so helpful!

I am a beginner, and my English also.
where I must build in the source code

Greetings from salzburg

Thanks Steve!

if [ $waittime -le $INI__musicbox__autoplaymaxwait ]
then
echo “Mopidy startup complete, playing $INI__musicbox__autoplay”
mpc ls “Local media/Tracks” |mpc add
mpc random on
mpc repeat on
mpc play

#mpc add “$INI__musicbox__autoplay”

mpc play

Of course, you are right on the money there, Steve. You need to set the autoplay setting to something (literally any non-empty value will do) else that part of the startup code will be skipped. For that reason I don’t think you want to be removing the autoplay value afterwards, if that still works then that’s actually a bug.

We need a more user-friendly way to have this configurable. I’m open to suggestions.

[quote=“kingosticks, post:11, topic:1648”]
You need to set the autoplay setting to something
[/quote] Frustratingly simple when you think about it - still took me ages to round the long way

Quite right about the autoplay value, something needs to be in there. For now I have just put ‘Remove this text if you don’t want autoplay’

I’m not sure if it’s a problem or not, as the Pi is designed to be permanently on, the reboot and autoplay issue probably doesn’t occur very often.