Close

Playlist Generation for Auto Play On Startup

A project log for PiFold

PiZero+CustomAccessPoint+CaptivePortal+AudioStreaming+PiFM+Voip in a wallet. Cash, Cache and Content. (optional Solar Charger)

tomwsmftomwsmf 02/06/2016 at 10:490 Comments

As I was dorking about with PiFM I took a few moments to find a bit of code to create a playlist of all the mp3 in under the content/Radio/ directory and make that playlist the default start up media. Sprinkle the randomness and all that is needed are cheesy bumpers.

cd /home/pi/content/Radio
find /home/pi/content/Radio/ -type f \( -name "*.mp3" \) | sort > /home/pi/content/Radio/playlist.m3u
chmod a+rx /home/pi/content/Radio/playlist.m3u
Now you just need to change a line in the VLC startup script
sudo nano /etc/vlc/start.sh
Find the line that ends with /home/pi/content/Radio/welcome.mp3

and replace that part with.

/home/pi/content/Radio/playlist.m3u

Reboot the server

sudo sync
sudo reboot
Power off and power back up.

All the mp3 files will now be served up in their time.

"I am a D.J., I am what I play" D.B.

Discussions