raspberry pi as cd ripper

it’s very easy! i used this tutorial
install abcde (A Better CD Encoder), flac (for the „free lossless audio codec„) and eject to eject to cd.


  sudo apt-get install abcde flac eject
test the eject program to open your cd/dvd-drive

  eject

now copy the original config-file from abcde to a temp-folder and replace the original with the following commands. for your system you have just to modify the path where your flac-files should be stored (edit OUTPUTDIR=/media/usb/cd-rip).


CDDBMETHOD=musicbrainz
CDDBPROTO=6
HELLOINFO=“`whoami`@`hostname`“
NOSUBMIT=y
FLACENCODERSYNTAX=default
CDROMREADERSYNTAX=cdparanoia
PADTRACKS=y
INTERACTIVE=n
LAME=lame
FLAC=flac
ID3=id3
ID3V2=id3v2
CDPARANOIA=cdparanoia
EJECT=eject
METAFLAC=metaflac
CDSPEED=eject
LAMEOPTS=‘–preset extreme‘
FLACOPTS=“-f –best“
ACTIONS=cddb,read,encode,tag,move,clean
CDROM=/dev/sr0
OUTPUTDIR=/media/usb/cd-rip
WAVOUTPUTDIR=/tmp
OUTPUTTYPE=flac
OUTPUTFORMAT=’${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}‘
VAOUTPUTFORMAT=’Various/${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}‘
ONETRACKOUTPUTFORMAT=$OUTPUTFORMAT
VAONETRACKOUTPUTFORMAT=$VAOUTPUTFORMAT
LOWDISK=n
PLAYLISTFORMAT=’${ARTISTFILE}/${ALBUMFILE}.${OUTPUT}.m3u‘
VAPLAYLISTFORMAT=’${ARTISTFILE}/${ALBUMFILE}.${OUTPUT}.m3u‘
EJECTCD=y

now try to encode some tracks of your cd, eg track 1, 2, 4
  sudo abcde 1-2 4

to convert to mp3 also install lame codec and id3 and id3c2
  sudo apt-get install lame id3 id3v2

now start to rip to flac and mp3 in one step (eg only track 1, 2, 4)
  sudo abcde -o „flac“,“mp3″ 1-2 4

next step is to automate the ripping task

create a new file

  sudo nano /usr/local/sbin/audio-cd-rip.sh

Now the few lines of code
#!/bin/bash
LOGFILE=/var/log/cdrip.log
echo „$(date)“ >> $LOGFILE

(
# Wait for lock on /var/lock/.audio-cd-rip.lock (fd 200) for two hours
flock -x -w 7200 200 || exit 1

abcde 2>&1 >> $LOGFILE
rc=$?
if [[ $rc != 0 ]] ; then
eject
exit $rc
fi
) 200>/var/lock/.audio-cd-rip.lock
Mark the script executable.
  sudo chmod +x /usr/local/sbin/audio-cd-rip.sh
Now we create a udev rule that runs this script. A udev rule lets the udev service call our script it the conditions of the rule match.
  sudo nano /etc/udev/rules.d/99-cd-audio-processing.rules
Insert one single line:
SUBSYSTEM==“block“, KERNEL==“sr0″, ACTION==“change“, RUN+=“/usr/local/sbin/audio-cd-rip.sh &“
This says, that the script shall run when a CD with at least one audio track is inserted in block device sr0 (which is usually your first CDROM/DVD/WHATEVER-Drive). The script will run in background (you see the ‘&’?). Now reload udev rules
  sudo udevadm control –reload

due to bugs in the OS you have to make the following work-around to „active“ the cd-drive

  sudo crontab -eAdd this line at the end
  */1 * * * * /bin/touch /dev/sr0

but the cd-drive always opens and closes – so that’s not a good workaround 😦

Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s