Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wasn't quite sure where to put this, hopefully this forum is suitable.
At home I have a Mac mini running as a server which hosts all my music (in digital form). From time to time it's useful to be able to play an actual CD though, and my CD player recently packed in. Since the Mini is next to my stereo, I thought I might be able to use that to play CDs rather than having to find another CD player. There are a couple of complications though.
The server is set up headless, i.e. no mouse, keyboard or monitor, and it's not got X installed either. I access it via ssh for maintenance, but I don't want to have to do anything interactive to play CDs. I'm not bothered about being able to skip tracks or anything, just put in the CD and have it play. Since Mac minis don't have an eject button, I also want the CD to eject when it's finished playing.
Here's an outline of what I want to happen:
CD is put into the server
Server checks if it's an audio CD (either true red book or mixed mode)
If it's not an audio CD, nothing further happens
If it is an audio CD, the CD begins playing from start to finish
When the CD has finished playing, it is ejected
Does anyone have any suggestions on how I might go about setting this up? The parts I'm particularly unsure about are how to make something happen automatically when the CD is put in, how to check what kind of CD it is, and how to play it from start to finish without interaction. I know there are various command line CD playing programs which can probably play it okay, and of course the 'eject' command will eject the CD, but putting all the steps together seems tricky.
I have a few years of experience with Linux, as well as some basic scripting knowledge, so I'm not bothered by technical instructions, and I'm not asking for a full howto or anything, just a few pointers and suggestions of programs that might be useful.
Well, you can create a script using the command-line tool cdcd.
Quote:
cdcd> ?
Commands: !, ?, access, close, debug, device, edit, eject, exit, ext, ff,
getvol, help, info, list, next, open, pause, play, prev, quit, refresh, resume,
rew, rndplay, setvol, sites, slot, status, stop, toggle, tracks, and verbose.
For more specific help, type `help <command>'.
cdcd> help play
Usage: play [starttrackname/track #] [endtrackname/track #] [min:sec]
By default, starts at the beginning of the CD. You may specify tracks using
either the number of the track or a section of the track's name. The disc will
play from where it starts to the end of the disc or a track you specify. You
may also specify a position within the first track to start.
cdcd> help info
Usage: info
Display statistics regarding the CD, such as name, artist, number of tracks,
etc. When you invoke this command for the first time on a particular CD, it
will block as it attempts to retrieve CD information from the CDDB.
It looks like it has all the functionality you need.
Thanks for that, I'd found cdcd but was having trouble getting it working. On Ubuntu it gives a cddb query error, which I thought was a bug but was actually because the default cddb mirror is defunct. Refreshing the cddb list fixed this problem, and CDs seem to play alright.
Turns out there is another problem though, apparently Mac Minis don't have a CD audio cable, which means the only way to play CDs is via the IDE interface. I haven't been able to find a command line CD player that does this, the only possibilities seem to be xine and xmms, so I think I might have to give up on the idea. Thanks for your help anyway.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.