The Headless MP3 Player

Using applications, configuring, problems
Post Reply
Message
Author
CainRam
Posts: 2
Joined: Sat 10 May 2008, 04:30

The Headless MP3 Player

#1 Post by CainRam »

Hey, all - Long time listener, first time caller.

Here's what I want to do - configure a Puppy hard-disk installation to start playing my music library randomly on boot. I'm installing this in my workshop at work and want to just tuck the box away with no monitor and push power to start the music and push it again to stop it.

I've been using Puppy since early 3 series so I know pretty much how it works. I'm looking for things like application suggestions, command line tricks, scripting advice, whatever will get the job done. Specifically, how do I automatically run a command on boot?

Thanks in advance,
Ramsey

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#2 Post by jemimah »

Here's a command that should play just about any type of song from the command line.

Code: Select all

ffmpeg -i "/dir/file" -f au - | aplay -D plughw
If that's too ugly, you could compile mpg321 or something similar. You can set the volume level from the command line using the amixer command.

You'll have to script the random song part. You can google for examples, such as this one. http://www.gilesorr.com/code/randsong.html

If you want the power button to shut down automatically you'll probably need acpid. http://www.murga-linux.com/puppy/viewtopic.php?t=38173

There's a few ways you can make it automatically start. The way I would do it, is edit /etc/profile. At the bottom where it says "exec xwin", I would put "exec /bin/RandomSongScript.sh" (or whatever you named it). That will prevent X windows from starting, but you shouldn't need it anyway since there's no monitor. Also with fewer processes running, less can go wrong.

Another thing you might consider is mounting your disks read-only to hopefully help prevent any file system corruption since the data shouldn't change, and you never want to have to do any maintenance. That way if it ever refuses to power off, you can pull the plug without worries.

CainRam
Posts: 2
Joined: Sat 10 May 2008, 04:30

Thanks!

#3 Post by CainRam »

I've looked into mpg123 and have the commands I need for that figured out.
I've been playing with /etc/init.d (I think) and the /etc/profile thing sounds more like what I'm looking for.
Can I mark my entire partition read only and still boot and run normally? I had considered this but wasn't sure if I'd be getting weird errors?

thanks so much for the advice!!

cainram

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#4 Post by jemimah »

hmmm, I actually haven't messed with a read-only save file. It probably would be a bit of a pain. However, you could easily Ramboot if you have enough ram.
http://www.murga-linux.com/puppy/viewtopic.php?t=48465

You wouldn't want to put the MP3s in your save file in that case. You can just save them on the hard drive, on their own partition, outside the save file, and then add an entry to the /etc/fstab file to mount the mp3 partition read-only.

murmelbahn
Posts: 47
Joined: Sun 15 Mar 2009, 13:20

#5 Post by murmelbahn »

CainRam,

if you're managing your "blind" jukebox from a central bash script and call
a music player from within that script, control will go over to the player
(whose window is now in focus), at least until the song finished playing --
unless you're running command line / outside X that is.
You can avoid this by using vlc and invoking it in daemon mode (vlc -d).

And when you've h(e)a(r)d enough, wmpoweroff will shut down.

Good luck.

JR

Post Reply