Mediaripper - Automatically Rip Audio CDs to MP3s
- 1 Credit and Origin of this Idea
- 2 What does it do?
- 3 Requirements
- 4 Installation
- 5 Configuration
- 6 Starting Mediaripper
- 7 Customizing
- 8 Troubleshooting and Behavior
- 9 References
Credit and Origin of this Idea
Mediaripper is the creation of B. Waite, a member of the Kurobox Forum.   It was an entry in a contest at that site. If you ever have a chance, tip your hat to him for his contribution to all LS and Kurobox users. It is an excellent concept and works well.
What does it do?
Mediaripper does several things automatically:
- insert an Audio CD into an attached USB/IDE CDROM drive/burner and it will rip the individual tracks to MP3 format, storing them where you configure it to, then auto-ejects the CD,
- insert a USB mass storage device and it will search for image files (jpeg, png, etc.) and it will store those files to your chosen destination, and
- insert a USB mass storage device and it will search for video files (xdiv, mpg, wmf, etc.) and it will store those files, also.
There is a DVD-ripping option that may be implemented in the future, but it is not currently functional.
- LS1 or HG (not yet tested on the LS2)
- Debian/FreeLink and a 2.6 Kernel
- USB/IDE CDROM drive or burner (for MP3 ripping)
- other USB mass storage devices (for image or video gathering)
From the Kurobox site, download the Mediaripper Package and install it:
wget http://www.kurobox.com/bwaite/mediaripper.tgz tar xzvf mediaripper.tgz
This downloads the package, unarchives it, and sets up the symlinks for the startup script. What is included in this tarred package? Here are the contents and their destinations/locations, with a description of each group:
# Three executable scripts and a configuration file that form the backbone of the application usr/local/bin/cdripper.sh usr/local/bin/ripper.conf usr/local/bin/ripperd.sh usr/local/bin/usbripper.sh # A Webmin module usr/share/webmin/mediaripper/ usr/share/webmin/mediaripper/images/ usr/share/webmin/mediaripper/images/linear.ia.gif usr/share/webmin/mediaripper/images/4.ia.gif usr/share/webmin/mediaripper/images/5.ia.gif usr/share/webmin/mediaripper/images/0.gif usr/share/webmin/mediaripper/images/1.gif usr/share/webmin/mediaripper/images/0.ia.gif usr/share/webmin/mediaripper/images/4.gif usr/share/webmin/mediaripper/images/5.gif usr/share/webmin/mediaripper/images/smallicon.gif usr/share/webmin/mediaripper/images/icon.gif usr/share/webmin/mediaripper/images/1.ia.gif usr/share/webmin/mediaripper/images/disk.gif usr/share/webmin/mediaripper/images/linear.gif usr/share/webmin/mediaripper/module.info usr/share/webmin/mediaripper/lang/ usr/share/webmin/mediaripper/lang/en usr/share/webmin/mediaripper/index.cgi usr/share/webmin/mediaripper/update_conf.cgi # A startup script for Mediaripper etc/init.d/mediaripper
Create symlinks to the executables:
ln -s /usr/local/bin/cdripper.sh /usr/bin/cdripper.sh ln -s /usr/local/bin/usbripper.sh /usr/bin/usbripper.sh ln -s /usr/local/bin/ripperd.sh /usr/bin/ripperd.sh
Create symlinks to the startup script:
update-rc.d mediaripper defaults
For me to get it to work, I had to create symlinks from /usr/bin to /usr/local/bin for cdripper.sh, usbripper.sh and ripperd.sh. Although I tinkered with it for quite a while, I just could not get it to work (automatically) without this step. If /usr/local/bin is in your $PATH, then it might work without the symlinks.
Install (from Debian stable):
apt-get install udev usbmount eject cdparanoia cddb libcddb2 cd-discid id3v2
Many of these packages are automatically installed if you have run the FreeLinkomatix script.
Install (from Debian testing)
apt-get install abcde
This package (abcde - A Better CD Encoder) is responsible for coordinating the access of the audio CDs, queries to the CDDB database, ripping .wav files from the CDs, and encoding those files to .mp3 format. Read the man pages of abcde for more information on this particular package and its back-end requirements. abcde has a configuration file in
where you can tailor it to your specific wants and needs. You can choose other encoders, for instance, and customize its behavior. This conf files is fairly well commented and is readable.
There are at least two options here (you choose):
- For excellent compatibility (including Roku devices), install the LAME encoder http://lame.sourceforge.net/. At the time of writing this article, the current version of LAME was 3.97, and (in FreeLink/Debian) it compiled out-of-the-box.
cd / wget http://downloads.sourceforge.net/lame/lame-3.97.tar.gz tar xzvf lame-3.97.tar.gz cd ./lame-3.97 ./configure make make install
- For faster, yet less compatible encoding (actually .mp2, strictly speaking), you can use toolame, which is available as a Debian (stable) package. Note that .mp2 files are not compatible with Roku devices and some mp3 players.
apt-get install toolame ln -s /usr/bin/toolame /usr/bin/lame
- For AAC,Ogg Vorbis or other encoding, choose and install the encoder of your liking. Read the documentation in the /etc/abcde.conf file or in the abcde man pages for details on encoder support. Note that this will require some editting of the cdripper.sh script.
Add Directories for MP3s, Images and Videos
After you have installed both the Mediaripper binaries and satisfied all dependencies, you now have to set up directories for processing and storage of the MP3s, images and videos. A great place to put these is in your data partition, which is probably in hda3 (instructions below assume this - adjust to your own setup as necessary). It is also good to place these in your Samba share, as it will make it easier to work with them from a Samba, NFS or AppleShare interface (we will assume this is in /mnt/share).
cd /mnt/share mkdir rippedmp3s chmod 777 rippedmp3s mkdir images chmod 777 images mkdir videos chmod 777 videos
The above commands (mkdir) create the directories and (chmod) make sure the will have unfettered access by any Samba user that attaches to your share(s). If privileges or security are a concern for you in this area, then you can adjust this to your situation.
Take note of the location of these directories, as you will have to specify them to the configuration file for Mediaripper.
For Mediaripper to function, it needs to know where to do its processing and store the finished MP3 & M3U playlists, images and videos. This information is specified in
and peeking at its structure, one can see there are obvious variables that one can supply values to, such as:
INTERVAL=60 #how often (in seconds) ripper checks for Audio CD (music), USB Mass Storage (images or video) IMGDIR="/mnt/share/images" #set this to the location where you want to store your images VIDDIR="/mnt/share/videos" #same for videos MUSICDIR="/mnt/share/rippedmp3s" #same for MP3s IMGTYPES="jpg bmp gif" #extensions for images VIDTYPES="xvid mpg wmf" #extensions for video files MUSICTYPES="ogg mp3 wav flac" #extensions for music
Use nano or your favorite editor to make this file reflect where you want each kind of files to be kept. These locations must agree with the three directories that you set in in the installation phase above.
While the originator of this article was initially unable to get the Webmin module to function, it has been repeatedly shown to work once installed and after Webmin was upgraded to 1.320. It is not known if this is a compatibility requirement, or if there is something about the module that requires a nudge or touch that occurs during Webmin upgrade.
To start mediaripper, simply do the following:
To stop or restart it, replace start with stop or restart. I suspect that the startup script may need a bit of work, because although I have it set to start at bootup, and I do see it activate every 60 seconds when I have "top" running, it doesn't function without manually starting it (using the above listed command). Perhaps the $PATH has to be added to the original startup script.
Controlling Encoding Quality & Options
You can pass arguements to specify the type (variable, average, constant) of bit rate and the quality of the encoding. See the abcde and lame man pages for more details, but here is a starter. Using nano or your favorite editor, open /usr/local/bin/cdripper.sh . Find the following line:
abcde -d $CDS -o mp3 -acddb,tag,playlist,move,clean -N -l -m -x
which rips each track to 128kbps, adds CDDB-style tags and track title with sequence numbers, creates a static playlist, moves the .mp3 files to a directory named by Artist_Album, and cleans up after itself.
- For fast, very high quality (near-archive, variable bit rate around 220kbps) rips, change that line to:
abcde -d $CDS -o mp3:"-V1 --vbr-new" -acddb,tag,playlist,move,clean -N -l -m -x
- For no static playlist creation, delete the "playlist" option from the above listed lines. These static playlists are not robust enough to stand up to a move of the files, since they are referenced by inode.
Easy Access to Encoded Music via Samba
If you access your music share(s) via Samba, you may notice that the output from Mediaripper is read-only. A simple (albeit perhaps inelegant) way around this is to add in the lines (comments are optional) at the end of /usr/local/bin/cdripper.sh:
if [ "$?" -eq 0 ]; then echo $DISCID >> encoded_discs fi # make the whole music directory universal rwx chmod -R 777 $MUSICDIR cd $THISDIR fi done
As usual, if you are concerned about security, then adjust this to your needs.
Troubleshooting and Behavior
- If Mediaripper is working properly, you really should be able to just pop an audio cd in the usb cdburner, close the tray, wait for a few seconds (up to 60 seconds) for ripperd.sh to sense that there is work to be done (tunes to be ripped), and the drive should whir into action.
- When it is done, the tray will eject/open automatically.
- If the CD has already been ripped, then it will do nothing (except repeatedly peak at the CD, about every minute).
- Ripping speed
- 1.5x to 3x, using toolame (default CBR 128kbps)
- .7x to 1.1x, using lame 3.97, good quality (default CBR 128kbps)
- .8x to 1.2x, using lame 3.97, very high/near-archival quality, VBR around 220kbps (-V1 --vbr-new) using the new VBR routines in 3.97
- For each rip, abcde will create a directory of the form abcde.X, where X is a numerical string identifying the CD in the online CD database. This directory contains files needed for the processing of the CD. It is automatically deleted at the end of an encoding cycle.
If it won't work
- Run top or do a ps aux to see if ripperd.sh, cdripper.sh, cdparanoia, abcde or lame are running. Note that if something causes an ungraceful exit to one of these processes, you may have to manually kill the remaining processes. Slow ripping or errors in the abcde.X directory can be symptoms of multiple/conflicting instances of these program running.
- Check dmesg, /var/log/syslog and /var/log/ripper for pertinent log or error messages.
- Try running ripperd.sh from the command line to see errors and/or output.
- You can also try running cdripper.sh from the command line to get a feel for what it is doing.
If it was working, but suddenly it doesn't anymore
- You may have already ripped the CD. The application abcde keeps a list of CD's that it has processed, in your music directory, called "encoded_discs". For whatever reason, if you want to repeat a rip, you must either delete this file, or edit out the ID number of the CD. Deleting it is far easier.
- Make sure your CD is clean and (as) scratchfree (as possible).
- You should also delete any static playlist or directory that is the result of a bad rip.
LinkStationwikinet Forum Thread by member Francis Schmidt RE "Changing Everything - MP3 Ripper/Server: http://forum.linkstationwiki.net/index.php?action=vthread&forum=4&topic=1299&page=0#msg11390
Settings for LAME (lame) - http://www.hydrogenaudio.org/forums/index.php?showtopic=28124