]> diplodocus.org Git - flac-archive/blobdiff - fa-rip
(get_decod_args): The third time field is *sectors*, not hundredths of
[flac-archive] / fa-rip
diff --git a/fa-rip b/fa-rip
index 55b2fb26791cf7d69cd1f59afaa159ae594c8df7..c3316484f83c125d70f2b372311ac1476fcb3da5 100755 (executable)
--- a/fa-rip
+++ b/fa-rip
@@ -3,12 +3,15 @@
 # $Id$
 
 set -e
-setopt NULL_GLOB
 
-get_cddev () {
-    local raw
+function get_cddev {
+    typeset raw
     raw=$(sysctl -n kern.rawpartition > /dev/null | awk '{printf "%c",97+$0}')
 
+    if [[ -n ${ZSH_VERSION} ]]; then
+        setopt NULL_GLOB
+    fi
+
     for CDDEV in /dev/{cdroms/cdrom*,cdrom*,rcd*${raw},{a,}cd*c}; do
         [[ -e ${CDDEV} ]] && return 0
     done
@@ -18,19 +21,19 @@ get_cddev () {
 
 if [[ -z ${CDDEV} ]]; then
     if ! get_cddev; then
-        echo 'CDDEV environment variable not set, defaults did not work'
+        echo 'CDDEV environment variable not set, defaults did not work' >&2
         exit 2
     fi
+    export CDDEV
 fi
 
-discid=($(cd-discid ${CDDEV}))
+dir=$(mktemp -d flac-archive.XXXXXXXXXX)
+cd ${dir}
 
-[[ -d $discid[1] ]] || mkdir $discid[1]
-cd $discid[1]
+mkcue ${CDDEV} > cue
 
-eval fa-tags $discid &
+trackcount=$(grep -c 'TRACK.*AUDIO' cue)
 
-cdrdao read-toc --device ${CDDEV} --driver generic-mmc toc
-toc2cue toc cue &
+fa-tags ${trackcount}
 
-exec cdparanoia -d ${CDDEV} 1-$discid[2] wav
+exec cdparanoia -d ${CDDEV} 1-${trackcount} wav