rip-loop.sh: Ripping a few hundred CDs in a day
Last year after moving to a new house, I decided to finally set up some local backup functionality and found a Synology RS819 for a good price, added some drives to it, and started playing around with it.
From there, I decided to finally start ripping all the CDs that I had collected over the years that were taking up space in my office (where they still stand, only because I've conveniently forgotten to move them out to storage...) The main computer I have has an internal DVD drive but also some time ago I had purchased an external USB DVD writer (another thing that I had conveniently forgotten was that I actually already owned a DVD drive, especially a DVD writer). So as part of wanting to rip all the CDs I had, I reinstalled abcde
, ripped a disc, and almost immediately got annoyed by having to restart abcde
and remember which drive I was ripping from.
So I came up with a quick shell script, which I call rip-loop.sh
:
#!/bin/bash set -e # trap ctrl-c and call ctrl_c() trap ctrl_c INT _disc="$1" ctrl_c() { echo "** Trapped CTRL-C on $_disc" eject $_disc exit 1 } _rip() { abcde -d $_disc -NGB; } _wait() { sleep 10; } disc_ready() { setcd -i $_disc | grep 'Disc found' | wc -l } while ( true ); do echo "Checking if disc $_disc is ready" if [ $( disc_ready $_disc ) -eq 1 ]; then _rip $_disc fi echo "Sleeping" _wait done
The only dependency is on setcd
for checking to see if the drive is ready. It's possible there's another tool that could perform this same functionality, but I found this one and it was easy to implement in to the workflow.
With ./rip-loop.sh /dev/sr0
and ./rip-loop.sh /dev/sr1
I could put a CD in, wait for abcde
to finish it's process, and then replace the CD with the next one in the list. Everything was properly tagged and, from the magic of NFS on to the Synology, everything was written to the correct location automagically. I've provided the .abcde.conf
below in case anyone needs it.
CDDBPROTO=6 HELLOINFO="`whoami`@`hostname`" MP3ENCODERSYNTAX=lame LAME=lame LAMEOPTS='--preset insane' OUTPUTTYPE="mp3" CDROMREADERSYNTAX=cdparanoia CDPARANOIA=cdparanoia CDPARANOIAOPTS="--never-skip=40" CDDISCID=cd-discid OUTPUTDIR="/home/user/path/" OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM} ${TRACKFILE}' VAOUTPUTFORMAT='Various/${ALBUMFILE}/${TRACKNUM} ${TRACKFILE}' VARIOUSARTISTSTYLE="forward-dash" mungefilename () { echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\] } MAXPROCS=3 PADTRACKS=y EXTRAVERBOSE=y EJECTCD=y