Local Jukebox (No Internet) with PSA's in park setting

Cool stuff you can do with MPD. A place for you to put your hacks and patches, or be inspired by others'.
Post Reply
LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » December 22nd, 2015, 2:56 am

Greetings! New to MPD, not new to linux.

I'm interested in a player/script that will do the following:
  • Start automatically at 9:00am, stop at 5:30pm.
  • Insert a series of general Public Service Announcements (PSA's) every few songs. (We're open from 9 to 5, Bathrooms are to the right, Join us for a celebration next week, etc.)
  • Give 20-minute and 10-minute about-to-close message, then a final we're-closed message at 5:00pm.
  • Play a random curated assortment of thousands of audio files located in a specific folder (holiday, summer, winter, etc.) on a local hard-drive/sd card, etc., separate from the folder of recorded PSA's.
  • Don't play the same song again until all other songs have been played, then randomly resort and start over.
  • No reliance on internet streaming. It would just be hooked into a local audio system.
  • Start where it left off in its current playlist after a power failure or from 5:00PM the previous night.
  • Check for new songs on resort and incorporate into play.
I've looked around at what's available, and most GUI's seem to be geared toward organizing things manually. I'd rather not insert skatey-eight PSA's manually throughout a day's worth of audio, nor play songs in the same order every day.

It doesn't have to have a GUI. It doesn't even have to be command-line interface. If it just managed itself that could work. However, if it had a bluetooth or wifi GUI for android, I wouldn't hate that. (For skipping a song, stopping playback, blacklisting from future playback, etc.)

I'm asking because, while I could probably write a thoroughly messy script that would work with mpd and mpc that will handle this in bash, I'd rather find out if someone has already invented the wheel -- or at least the hub and spokes -- before creating my own.

I could try this on any of the following:
  • Raspberry Pi 2 with Raspbian
  • OrangePi PC with Ubuntu Vivid Mate
  • Dell Vostro 100 with Linux Mint 17.3 (Half a GB of RAM. Ugh.)
I'd be grateful for any reasonable suggestions or ideas on where to start, what works, what to avoid, etc.

Cheers,

Chris

max
Forum team
Posts: 922
Joined: January 15th, 2013, 3:43 pm

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by max » December 22nd, 2015, 8:02 am

Much of that can be done by simple "mpc" commands run by a scheduling daemon such as "cron". That is, start playback is just "mpc play"; inserting an announcement is "mpc insert ...". Some of the rest is what MPD does already: after reboot, it resumes where it stopped last time; its random mode ensures that no file is played twice until all have been played. What it does not do is auto-insert new songs into the queue.

You're probably ending up writing a few shell scripts. There will be no user interface, though. One could write a complex special client with a user interface for your use case, and others would probably benefit from such a client as well, but I know no existing one.

LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » December 22nd, 2015, 12:30 pm

max wrote:Much of that can be done by simple "mpc" commands run by a scheduling daemon such as "cron". That is, start playback is just "mpc play"; inserting an announcement is "mpc insert ...". Some of the rest is what MPD does already: after reboot, it resumes where it stopped last time; its random mode ensures that no file is played twice until all have been played. What it does not do is auto-insert new songs into the queue.

You're probably ending up writing a few shell scripts. There will be no user interface, though. One could write a complex special client with a user interface for your use case, and others would probably benefit from such a client as well, but I know no existing one.
max, thanks for this. It's good to know whether I'm covering new ground beforehand. I haven't installed this on any of my devices yet, but just looking around, I must be seeing an older version of the mpc man page, as it does not include the command "mpc insert". I'll check it out once I've installed mpd and mpc.

Example man pages:
http://linux.die.net/man/1/mpc
http://man.cx/mpc%281%29

Again, thanks!

LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » January 16th, 2016, 2:19 am

Okay, I've followed the directions in the Ultimate MPD Guide.
I've also installed mpc, ncmpcpp and gmpc successfully.
I am impressed with the various clients. And commandline access is sweet.

I've got it set to play music out of ~/Music/ in the ~/.mpd/mpd.conf file.

Everything works as expected.

My PSA's are in a folder ~/PSAs/

This is what happens when I try an insert from ~/PSAs/

Code: Select all

~$ mpc insert ~/PSAs/Ten-Minutes-To-Close.mp3
Segmentation Fault
~$
I also tried:

Code: Select all

~$ mpc insert /home/chris/PSAs/Ten-Minutes-To-Close.mp3
Segmentation Fault
~$
I want all the mp3's in the ~/Music folder to be automatically added to the current playlist, saved as ~/.mpd/playlists/All Music.m3u. I've set mpc to play them randomly. This all works fine.

However, I want my PSA's to live in a different folder so they are not automatically added to playlist nor played randomly. I want these to be inserted at specific times via cron job. I don't want people to hear that that it's 10 minutes to closing in the middle of the day.

What's causing the segmentation fault? Manpage suggests

Code: Select all

insert <file>
meaning I should be able to specify a file the normal way.

Have I missed something? Is my syntax incorrect?

Cheers,

Chris

max
Forum team
Posts: 922
Joined: January 15th, 2013, 3:43 pm

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by max » January 16th, 2016, 5:12 pm

If you see a crash, report a bug. Posting on the forum will not solve your problem.
However in this case, I believe your mpc version is outdated. It is annoying that you don't post your version numbers when you post about a problem, though.

LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » January 16th, 2016, 6:51 pm

max wrote:If you see a crash, report a bug. Posting on the forum will not solve your problem.
However in this case, I believe your mpc version is outdated. It is annoying that you don't post your version numbers when you post about a problem, though.
Max,

Thanks for your reply. Linux Mint latest, Cinnamon UI. I've tried it on both 32 and 64-bit Linux Mint for two different Dell Vostro 1000's. Please assume I have the lastest version of mpd and mpc, as Linux Mint is set to automatically install whatever needs updating. I have not seen any logs indicating there was an update that would affect the install I did this weekend.

Apparently, as of yesterday, there is a new version of mpd that fixes a non-linux problem.

As for bug tracking, I see a bug tracker for mpd. Do we use the same bug tracker for mpc? It is not readily apparent. Edit -- Okay I see where the MPC bug-tracker is.

Thanks for your patience.

Chris

max
Forum team
Posts: 922
Joined: January 15th, 2013, 3:43 pm

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by max » January 17th, 2016, 11:28 am

LaughterOnWater wrote:Please assume I have the lastest version of mpd and mpc, as Linux Mint is set to automatically install whatever needs updating.
I dont believe that.
According to http://community.linuxmint.com/software/view/mpd the latest MPD version in Linux Mint is 0.18.7, i.e. the package hasn't been updated for nearly 2 years!
Then there's http://community.linuxmint.com/software/view/mpc which states that the latest mpc version is 0.25, but that is 3 years old already!
Linux Mint is in a very bad state, its packages are not well-maintained. Don't use its MPD/mpc packages!

LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » January 17th, 2016, 1:14 pm

max wrote:
LaughterOnWater wrote:Please assume I have the lastest version of mpd and mpc, as Linux Mint is set to automatically install whatever needs updating.
I dont believe that.
According to http://community.linuxmint.com/software/view/mpd the latest MPD version in Linux Mint is 0.18.7, i.e. the package hasn't been updated for nearly 2 years!
Then there's http://community.linuxmint.com/software/view/mpc which states that the latest mpc version is 0.25, but that is 3 years old already!
Linux Mint is in a very bad state, its packages are not well-maintained. Don't use its MPD/mpc packages!
Sweet! Thanks. I had no clue. So I need to compile these myself?
Edit: I've downloaded and compiled mpd and mpc.

How do I fix this?

Code: Select all

~ $ mpd --version
Music Player Daemon 0.19.12

Copyright (C) 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright (C) 2008-2014 Max Kellermann <max@duempel.org>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Database plugins:
 simple proxy

Storage plugins:
 local

Decoders plugins:
 [dsdiff] dff
 [dsf] dsf
 [pcm]

Output plugins:
 null fifo oss httpd recorder

Encoder plugins:
 null wave

Input plugins:
 file

Playlist plugins:
 extm3u m3u pls xspf asx rss cue embcue

Protocols:
 file://
It no longer recognizes pulse, and seems to have trouble seeing my library at ~/Music/

skidoo
Posts: 168
Joined: April 28th, 2013, 10:06 pm
Location: Western Germany

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by skidoo » January 18th, 2016, 8:40 am

How do I fix this?
Missing developer (*-dev) packages? Please check configure output and logfile.

LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » January 18th, 2016, 9:15 pm

skidoo wrote:
How do I fix this?
Missing developer (*-dev) packages? Please check configure output and logfile.
Excellent. Done. mpd and mpc now work as expected. Thank you!

Only the mysqlite module would not install. All of the others did fine.
Although I had installed sqlite, libsqlite0, and libsqlite0-dev it remained disabled.

It's not a deal breaker, but all the other packages installed so easily on both 32 and 64-bit instances. Any ideas?

skidoo
Posts: 168
Joined: April 28th, 2013, 10:06 pm
Location: Western Germany

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by skidoo » January 19th, 2016, 12:05 pm

Code: Select all

Only the mysqlite module would not install. All of the others did fine.
Although I had installed sqlite, libsqlite0, and libsqlite0-dev it remained disabled.
MySQL <> SQLite. Try libsqlite3-0 and libsqlite3-dev on your *buntus.

LaughterOnWater
Posts: 16
Joined: December 22nd, 2015, 1:54 am

Re: Local Jukebox (No Internet) with PSA's in park setting

Post by LaughterOnWater » January 19th, 2016, 7:22 pm

skidoo wrote: MySQL <> SQLite. Try libsqlite3-0 and libsqlite3-dev on your *buntus.
Yup -- I conflated two totally different SQL packages didn't I? (Sorry.)

I'll definitely give it a shot next.

Thanks!

Post Reply