Raspberry Pi Automatic Music Player (using a Read-Only System)

Raspberry Pi: https://amzn.to/2PmPzYL (Amazon Affiliate)

Raspberry Pi Initial Setup: https://youtu.be/djOYldP3wFw

Free Music Here: https://freemusicarchive.org/genre/Halloween

Looping music original source: http://www.cenolan.com/2013/03/looping-video-playlist-omxplayer-raspberry-pi/

Adafruit Read Only Setup:

https://learn.adafruit.com/read-only-raspberry-pi/

musicplayer.sh
#!/bin/sh

# set here the path to the directory containing your music
MUSICPATH="/home/pi/music" 

# you can normally leave this alone
SERVICE="omxplayer"

# now for our infinite loop!

while true; do
        if ps ax | grep -v grep | grep $SERVICE > /dev/null
        then
        sleep 1;
else
        for entry in $MUSICPATH/*
        do
                omxplayer -o local "$entry" > /dev/null
        done
fi
done

Leave a comment

Your email address will not be published. Required fields are marked *