User avatar
piston9
Posts: 13
Joined: Sat Dec 14, 2013 11:20 pm
Location: Brisbaneish, Australia

Store music player

Tue Dec 17, 2013 2:37 am

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

User avatar
ACX
Posts: 9
Joined: Tue Dec 17, 2013 9:39 am
Location: Udine, Italy
Contact: Website

Re: Store music player

Tue Dec 17, 2013 9:48 am

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!

User avatar
piston9
Posts: 13
Joined: Sat Dec 14, 2013 11:20 pm
Location: Brisbaneish, Australia

Re: Store music player

Tue Dec 17, 2013 11:40 am

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)

User avatar
ACX
Posts: 9
Joined: Tue Dec 17, 2013 9:39 am
Location: Udine, Italy
Contact: Website

Re: Store music player

Tue Dec 17, 2013 3:25 pm

Are your ads audio files? If so, you just have to write a simple script to populate the Playlist in the way you described.

benthebaddy
Posts: 1
Joined: Mon Nov 16, 2015 4:05 am

Re: Store music player

Mon Nov 16, 2015 4:08 am

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.

SteveberryPi
Posts: 6
Joined: Mon Jan 16, 2017 9:55 pm

Re: Store music player

Mon Feb 27, 2017 3:02 pm

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

Return to “Graphics, sound and multimedia”