]> git.rmz.io Git - dotfiles.git/blobdiff - bin/batch2iso
add tardis bin
[dotfiles.git] / bin / batch2iso
diff --git a/bin/batch2iso b/bin/batch2iso
new file mode 100755 (executable)
index 0000000..f95f18a
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/bash
+
+if [[ $# > 1 ]]; then
+    echo "This script accepts at most 1 Argument!" >&2
+    exit 0;
+fi
+
+DIR=${1:-.}
+for F in $DIR/*; do
+    if [ -f "$F" ]; then
+    E=${F: -3}
+    N=`basename "$F" .$E`
+    case "$E" in
+        "bin")
+            hash bchunk 2>&- || { echo >&2 "I require bchunck but it's not installed.  Aborting."; exit 1; }
+            if [[ -e "$N.cue" ]]; then
+                bchunk $F $N.cue $N.iso
+                echo $N
+            else
+                echo "No cue-sheet found! Please convert manually." >&2
+            fi
+            ;;
+        "mdf")
+            hash mdf2iso 2>&- || { echo >&2 "I require mdf2iso but it's not installed.  Aborting."; exit 1; }
+            mdf2iso "$F" "$N.iso"
+            ;;
+        "nrg")
+            hash nrg2iso 2>&- || { echo >&2 "I require nrg2iso but it's not installed.  Aborting."; exit 1; }
+            nrg2iso "$F" "$N.iso"
+            ;;
+        "img")
+            hash ccd2iso 2>&- || { echo >&2 "I require ccd2iso but it's not installed.  Aborting."; exit 1; }
+            ccd2iso "$F" "$N.iso"
+            ;;
+    esac
+    fi
+done