Automated MP3 Ripping?
jimiUK asks: "I've been working for a while on my streaming mp3 server, using Apache:MP3 running on FreeBSD to start with but now running on RedHat Linux. It all runs smoothky, but what I'm trying to do is automate the ripping process so I can just insert cd's and have them ripped and classified automatically. This box is a dedicated server without a keyboard or moniter connected so I'd rather have no user input whatsoever. I've solved all of the initial problems, and now have the box set to login automatically on boot up, but I still can't find the right script. The most useful has been autorip, and I've also tried ripit (although it requires user intervention). My main problem is that if autorip cant find the cd information, it just stalls. My Perl skills are non-existent really so i'm not sure how to alter the script to instruct it to rip away if it doesnt find track info, which I could add in later. Does anyone have any other suggestions for alternative script front ends, or can point me in the right direction on altering autorip to get it over this hurdle." For those of you running MP3 servers, this idea might be a huge timesaver. Has anyone implemented such a system?
I've used SoundJam and iTunes to autorip MP3s. They rip, encode, and name (via CDDB) at 2x-3x on my (fairly old) PowerMac. Pair that up with Apache (on MacOSX) or any one of a number of Mpeg streaming servers and your good to go.
Oh, but wait, it's not open source, free, and it doesn't run under linux (or even on X86 hardware) so don't even consider it.
Mod me as -1 Flamebait or +3 Informative
Check out
A Better CD Encoder (abcde)
and
Otto
I'm doing exactly what you describe with a spare laptop that had it's keyboard mangled.
I created a supervise/svscan job to monitor the CDROM and tun abcde if it finds a CD, which allows me to insert a CD and have the laptop eject the CD when it's done ripping.
Complete directory structure support for title/artist info.
freedb and cddb support.
otto then lets me play the new mp3s, and it makes life easier by managing them in mysql. I'd be happy to pay for abcde and otto, someone took the time to tie a bunch of tools and funtionality into a practical interface.
My autoripper goes ahead and rips the disc with generic track names, but goes a step further.
Once a day, it will attempt to lookup the track names again, once they appear in freedb, the tracks get named and stored appropriately.
Sorry, it's part of a larger project which I'm not free to redistribute.
Apple's iTunes does this, so it's obviously possible. Doing it with command-line tools may not be easy, though.
Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
I foresee a problem here. The song title may contain a slash or other "naughty" character that isn't whitespace. Now, on Unix file systems, the slash is the only show-stopper, but I've heard complaints from Windows users that the question mark causes tremendous grief.
Just like when you write a CGI that accepts user input from a URL, your CDDB lookup is relying on outside information. Rather than stripping out a subset of characters that you know to be undesirable (whitespace in your case), you need to take the more proactive approach -- only allow characters you know you want, and clobber all the rest.
Also for what it's worth: I prefer cdparanoia for ripping, and I'd put the encoder and its options up at the top of the script where they can be configured more easily.
On the Windows side, Musicmatch does it, and on the Mac side, the default iTunes does it. Also, since you can display visualization for CDs, the data is being read at the same time it is playing... it's one more step to encode (hey! how about a "visualization" plug-in that encodes? I'm not sure if all data is fed to the plugins, though...)
If you're using a nice Multitasking OS, why not just write a script that starts encoding (you'd have to make sure it writes to the final files directly, and not some intermediate file), forks, and pauses 2 seconds, and starts playing the files by chronological order, starting with a date one minute in the past. Each time a song finishes, regenerate the playlist to reflect new songs that have been encoded, and progress through them. Then, you can be done encoding, and have it prompt you for another CD, even before the first has finished playing.
It doesn't even require perl - a simple bash script with find, plaympeg and your encoder of choice (abcde seems to be recommended) could easily accomplish this.
--
Evan
"$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
but most especially, it's not automatic on a headless box
Slackware: old school feel, new school gear.
Email the compile errors to me (not just the "make : *** [target] Error 1" stuff please) and I'll see if I can help.
It needs to be run after the cd is in. It has no "waiting state". I'd recommend running it from something like autorun.
What I usually do with abcde is generate a playlist (which is created before any of the tracks are read), wait for one or two tracks to encode, and then play the list in any playlist-capable player. By the time the player gets to the next track, that track would have finished encoding.
Disclaimer: I wrote abcde.
You mention that Autorip stalls when it can't find the CD info... how would you prefer it worked? Unfortunately, without a display, the only option would be to silently eject the disc so you can go on to the next, and you'd never know that that disc didn't RIP.
Were I doing this kind of bulk ripping, I'd want it to rip the disc and put the files aside in a special directory. Then I would come back at the end of the day and enter the track info in a big batch. That way I could feed it disc after disc without thinking about it until I was ready.
The CD-ROM drives I have on my desktop are all awful for ripping; in particular, they are slow, error-prone, and woefully intolerant of scratches. One is so lousy that it will take 3 hours to rip a 45-minute CD.
Happily, one of them just died, so I'm looking for a replacement. What EIDE CD-ROMs are best for ripping? Or are they all equally good these days?
vnc is a bit of overkill...
(open)ssh will do the same task just as welll
and if needed... you can do X11 forwarding over ssh
Need a Catering Connection
#!/usr/bin/perl
/dev/acd0c -I cooked_ioctl -s -b 16 -x -t$tknm $album$tknm.wav`;
#By Jason Denton, Copyright 2001
use Audio::CD ();
use MP3::Info;
$cddev = '/dev/acd0c';
$cd = Audio::CD->init($cddev);
$info = $cd->stat;
$cddb = $cd->cddb;
$data = $cddb->lookup;
$_ = $data->artist;
s/\W/_/g;
$artist = $_;
$_ = $data->title;
s/\W/_/g;
$album = $_;
$genre = $data->genre;
$tknm = 1;
$year = 2001;
foreach $track (@{$data->tracks($info)}) {
$_ = $track->name;
s/\W/_/g;
$title = $_;
$mp3name = "$artist\_$album\_$title.mp3";
`cdda2wav -D
`lame -m s -b 160 -h $album$tknm.wav $mp3name`;
`rm $album$tknm.wav`;
`rm $album$tknm.inf`;
set_mp3tag ($mp3name, $title, $artist, $album, $year, "", $genre,$tknum);
$tknm++;
}
Jason Denton Colorado State University [Thoughs and comments are my own, and not reflective of CSU]
If you are going to troll, at least put some effort into it.
Malcolm solves his problems with a chainsaw,
Malcolm solves his problems with a chainsaw,
And he never has the same problem twice.
If your box is sitting on a network, try installing VNC.
I have several small networks that I support and I mostly use Linux on the servers and firewalls. Since I don't always have a monitor and keyboard that I can dedicate to a machine that is rarely used by a person (and usually stuffed into a closet somewhere), I install VNC and have it run on boot.
This will not solve your problem with how to auto-rip MP3's, however if your MP3 server goes down or stalls for some reason, you can just VNC into the machine and see what is happening and fix it.
Or perhaps this will solve your problem, since now you can have "user input" from any machine on your network.
The solution to your problem is Lego Mindstorms and a nice script. (Posted earlier). Just build a little robot to load and unload the CD's from the tray, and then rip and repeat.
Sounds like a fun weekend project. You could have it queue up hundreds of CD's... and let it rip. (Pun intended)
This was posted some time ago...
Lego DJ thing
I would like to extend this question by asking if it is feasible to rip and play at the same time? I don't see why not if you are ripping at >1x but has anyone ever managed to do this?
What I was wanting to do is to be able to pop in a CD, listen to it, and when I'm done listening to it, it will be archived in my MP3 collection for easier listening later.
I really haven't done much CD ripping though, so I'm no expert on the subject. Is this possible? Are there any tools out there that allow this (while still allowing the automated ripping like the origional poster asked)? Or can the music be ripped/encoded fast enough that the MP3 can just be listened to as it is being ripped? Anyone have any solutions?
I like Grip. This GPL program can be configured to rip+encode CDs upon insertion and will eject them when done ripping (encoding is a separate process which can be queued up for later since it takes longer than ripping). You can choose from several encoders and the CDDB info is automatically collected. If you install the companion program, Digital DJ, the CDDB info will be shoved into a MySQL database for easy music management/playlist manipulation later on.
You could produce a tone through the PC speaker untill the user ejects the cd, or for a specified amount of time.
If missing discs completely is acceptable to you, it would probably be very simple to hack the Perl scripts. I'm sure there's other hackers out there like me that would be happy to take a look at it. However, consider the above carefully first.
MadCow.
I used to have a sig, but I set it free and it never came back.
I'd highly recommend AudioCatalyst 2.1 from Xing
(Actually now owned by RealNetworks)...$30 or
so. Works great, rips, encodes and names (via CDDB)
at 8x in one pass on my box.
Oh, but wait, it's not open source, free and
it doesnt run under linux so dont even consider
it... Sheesh.