Last Updated: February 25, 2016
·
830
· jinnko

ripright on debian wheezy

Was digging through storage over the weekend and found boxes of old CD's I've been meaning to rip onto my media server. Found ripright and got it working to auto rip when a CD is inserted.

From the site: "RigRight is a minimal CD ripper for Linux modeled on autorip. It can run as a daemon and will automatically start ripping any CD found in the drive after which the disc will be ejected."

Install dependencies

# apt-get install build-essential pkg-config libflac-dev libcdparanoia-dev libmagickwand-dev libdiscid0-dev libcurl4-gnutls-dev eject

Build ripright

$ wget http://www.mcternan.me.uk/ripright/software/ripright-0.7.tar.gz
$ wget http://www.mcternan.me.uk/ripright/software/ripright-0.7.tar.gz.sig
$ gpg --recv-keys EBF7AC52
$ gpg --verify ripright-0.7.tar.gz.sig ripright-0.7.tar.gz
$ ./configure
$ make
$ make check
$ sudo make install

Start ripright

$ nice -n 5 ripright --allow-skips --require-art --folder-art folder.png --output-file "%B/%D/%N - %T.flac" /path/to/ripright/out

Sync script

Having the output folder on an NFS mount fails and locks up the system. The mount I'm using has the following options which should allow the app to fail gracefully but doesn't: soft,bg,proto=udp,nfsvers=3,rsize=16384,wsize=16384,retry=1. It seems to hang on the encoder.

Fortunately the files are moved to the target location atomically so using a cron or similar should workaround the usability. Here's a script that'll do the job.

#!/bin/dash

PATH_TO_RIPS=/path/to/ripright/out
PATH_TO_MUSIC=/vols/media/Music/ripright

cd $PATH_TO_RIPS

for ARTIST in *; do
    cd "$ARTIST"
    find . -maxdepth 1 -type d -mmin +15 | while read ALBUM; do
        if [ "$ALBUM" != "." ]; then
            if [ -d "$PATH_TO_MUSIC" ]; then
                TARGET_PATH="${PATH_TO_MUSIC}/${ARTIST}/${ALBUM}"
                [ -d "$TARGET_PATH" ] || mkdir -p "$TARGET_PATH"
                ionice -c3 nice -n15 rsync -a --remove-source-files "$ALBUM/" "$TARGET_PATH/"
                [ $? -eq 0 ] && rmdir "$ALBUM"
            fi
        fi
    done
done