From 302f185d2d0383bdb3193460fb8cc7efa08ac474 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Tue, 13 May 2014 00:26:03 +1000 Subject: [PATCH] rip-dvd: convenient script to rip a series of DVDs and auto-number directories --- rip-dvd | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 rip-dvd diff --git a/rip-dvd b/rip-dvd new file mode 100755 index 0000000..aeee4d7 --- /dev/null +++ b/rip-dvd @@ -0,0 +1,50 @@ +#!/bin/bash -e + +DVD_DEVICE="${DVD_DEVICE:-/dev/dvd}" + +if [ -z "$1" ]; then + echo "Usage: $0 NAME [num]" + exit 1 +fi + + +# Calculate the name for ripping +base="$1" +last="$(find . -maxdepth 1 -type d -name "${base}*" | sort -n | tail -n 1)" +if [ -z "$last" ]; then + num="1" +elif [ -n "$2" ]; then + num="$2" +else + num="${last##./${base}}" + num="$(($num + 1))" +fi +next="${base}${num}" + + +# Sometimes the cached keys are wrong, since it only takes a few seconds to +# recrack I prefer to do it each time +rm -rf ~/.dvdcss + +# Need to use libdvdread/libdvdcss to unlock the drive before copying +identify-dvd "$DVD_DEVICE" + + +echo +echo +echo "Will rip to '$next'" +for i in $(seq 3 -1 1); do + echo " $i..." + sleep 1 +done + + +# Rip to ISO skipping bad sectors then decrypt to VIDEO_TS directory +set -x +rm -rf "${next}" "${next}.iso" +ddrescue -n -b 2048 "$DVD_DEVICE" "${next}.iso" +dvdbackup -n "$next" -M -i "${next}.iso" || true +identify-dvd "$next" +rm "${next}.iso" +eject "$DVD_DEVICE" + -- 2.39.2