Page 1 of 1

Store music player

Posted: Tue Dec 17, 2013 2:37 am
by piston9
Hey all,

First major project with the pi is now up and running. I created an empty image that boots to raspbian and runs a script to play music in a bunch of our retail stores (I work in the motorbike retail industry). Our current paid solution costs about $1000 per store per year - this costs a pi and about $300 per year for the licencing - significant savings.

Goals -

- save money
- play music
- play messages that can be updated rapidly (current system - 2 months from wanting to getting)

How I did it

- System boots and runs mpg321 with a random script. It plays 3 songs, then a message. - rinse and repeat from 6am (started by cron) to 9PM.
- nightly it syncs our music library to the local SD with rsync -rtvu --delete /mnt/sm/music/ /home/pi/music/ - this is to reduce network load during business hours and ensure it works even if network is down.
- every 15 minutes it syncs the message folder with rsync -rtvu --delete /mnt/sm/messages/store/ /home/pi/messages/ . This allows marketing to place something or remove something with just a 15 minute window.

All pi's connect to a single music directory managed on a NAS at head office, but each is configured to it's own messages directory, so each store gets it's own.

Some potential? For example, we want to run a special on a bike- they can record a quick audio and it goes in the advertising loop within 15 minutes - and can be removed as fast.

Anyhow, I'm sure there are improvements to come, but thought if anyone is interested. We spent ages looking for a custom solution that we could control messages and music that wouldn't cost the earth - till I worked out I could just use a pi and write the script :D

#!/bin/bash
if [ -f /home/pi/music.lock ]; then
echo "Lock Exists, exiting"
exit 0
fi
touch /home/pi/music.lock
target="21"
cur=$(date '+%H')
while [ $target != $cur ]
do
cd /home/pi/music
mpg321 "$(ls *.mp3 | shuf -n1)"
mpg321 "$(ls *.mp3 | shuf -n1)"
mpg321 "$(ls *.mp3 | shuf -n1)"
cd /home/pi/messages
mpg321 "$(ls *.mp3 | shuf -n1)"
cur=$(date '+%H')
done
rm /home/pi/music.lock

Re: Store music player

Posted: Tue Dec 17, 2013 9:48 am
by ACX
Hello piston9, have you considered using RuneAudio (www.runeaudio.com) for your purposes? It has been created with the aim of transforming the Pi in an hi-fi music player, but of course it can be used in different contexts, for example as a bar/restaurant/store player. I'm one of the developers, we released our first working beta (limited in features) and we'd love to have some feedback on our work.

Ciao!

Re: Store music player

Posted: Tue Dec 17, 2013 11:40 am
by piston9
I had not - I will take a look... The only reason I chose what I did is for simplicity - in this case it is fully automated - 3 random songs and a random ad - rinse and repeat..... Though that looks interesting for the home setup (which is currently MPD)

Re: Store music player

Posted: Tue Dec 17, 2013 3:25 pm
by ACX
Are your ads audio files? If so, you just have to write a simple script to populate the Playlist in the way you described.

Re: Store music player

Posted: Mon Nov 16, 2015 4:08 am
by benthebaddy
Hey I know this is an old post but I am very interested in a script that would create a playlist that does the same thing as Piston9's original code.

Does anyone know how to do this? I am new to Raspberry Pi's and coding but would love something like this.

Re: Store music player

Posted: Mon Feb 27, 2017 3:02 pm
by SteveberryPi
Hi Guys,


Do you know if there is away to connect to runeaudio out side of the Pi network to upload and change order of music ? also if the power goes out dose the runeaudio system reset it self and start playing when the power get back on