Ripping a cd with embedded cuesheet

Rimuove Vecchi File Dal Cestino ◂ ▸ Sciocchezzario Berlusconi Del 2003
2008/04/15

Requires zenity, cueconvert, cdparanoia, cdrdao, rpl, flac I know: I could remove needs for rpl changing to sed, there's no need to change directory, zenity it's only to have a graphical interface, it would be simple using abcde, and removing indexes is not so good: the worst script you've ever seen :-)

#!/bin/bash
cd /mydir/
answer=$(zenity --entry --text "What is the name of the disc?" --entry-text "Disc name:")
disco=`echo "$answer"`
tocfile="tocfilename.toc"
tmpfile="temporary.cue"
cuefile="$disco"".cue"
imagefile="image.wav"
cdparanoia 1- "$imagefile"      ## This does the rip of entire CD to one single wav
cdrdao read-toc --device /dev/cdrom --with-cddb "$tocfile"  ##creates a toc-file fetching cddb data
cueconvert "$tocfile" > "$cuefile"  ##converts the cdrdao file format to toc format
cat "$cuefile" | grep -v "ISRC" > "$tmpfile"
cat "$tmpfile" | grep -v "INDEX 00" > "$cuefile"
rpl "data.wav" "image.flac" "$cuefile"
flac -8 --replay-gain -f "$imagefile"  ##encoding with flac
metaflac --remove-all image.flac
metaflac --add-replay-gain --import-cuesheet-from="$cuefile" --set-tag-from-file=CUESHEET="$cuefile" image.flac
mv image.flac "$disco"".flac"
rm "$cuefile"
rm "$tmpfile"
rm "$tocfile"
rm "$imagefile"
eject
Facebook Reddit Linkedin
Tags: linux