2022-01-06 12:31:30 -07:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
2022-01-09 16:26:12 -07:00
|
|
|
. $(dirname $0)/common.sh
|
|
|
|
|
|
|
|
setenv status "scanning"
|
2022-01-06 12:31:30 -07:00
|
|
|
|
|
|
|
log "Scanning for DVD title"
|
|
|
|
title=$(dvdbackup -I | awk -F \" '/DVD with title/ {print $2}')
|
2022-01-09 16:26:12 -07:00
|
|
|
setenv title "$title"
|
2022-01-06 12:31:30 -07:00
|
|
|
|
2022-01-09 16:26:12 -07:00
|
|
|
# How big is this DVD?
|
|
|
|
totalSize=$(dvdbackup -I | awk '/[MK]iB$/ { b += $2 } END { print b }')
|
2022-01-06 12:31:30 -07:00
|
|
|
|
2022-01-09 16:26:12 -07:00
|
|
|
dvdbackup -p -F -n DVD \
|
|
|
|
| tr '\r' '\n' \
|
|
|
|
| awk -F '[ /:]+' '
|
|
|
|
function update() {
|
|
|
|
print "% " pct;
|
|
|
|
fflush();
|
|
|
|
}
|
2022-01-06 12:31:30 -07:00
|
|
|
|
2022-01-09 16:26:12 -07:00
|
|
|
/Found [0-9]+ VTS/ {
|
|
|
|
numTitles = $3;
|
|
|
|
title = 1;
|
|
|
|
pct = 0;
|
|
|
|
print "# I found " numTitles " titles"
|
|
|
|
update()
|
|
|
|
}
|
|
|
|
/Copying menu:/ {
|
|
|
|
# Not sure how to know in advance how many of these there will be.
|
|
|
|
print "# We are reading the menu: " $0
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
/Copying Title,/ {
|
|
|
|
# Copying Title, part 1/5: 23% done (239/1024 MiB)
|
|
|
|
part = $4
|
|
|
|
parts = $5
|
|
|
|
done = $6
|
|
|
|
print "# Title " part " of " parts " pct " done
|
|
|
|
titleDone = (part * 100 - 100 + done) / parts;
|
|
|
|
if (titleDone < titleLast) {
|
|
|
|
title += 1;
|
|
|
|
}
|
|
|
|
titleLast = titleDone;
|
|
|
|
pct = (title * 100 - 100 + pctDone) / numTitles;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
{
|
|
|
|
print "## " $0;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
' \
|
|
|
|
| while read t val; do
|
|
|
|
case "$t" in
|
|
|
|
"%")
|
|
|
|
setenv complete "$val"
|
|
|
|
echo "Complete: $val"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$t $val"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2022-01-06 12:31:30 -07:00
|
|
|
|