-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdvd2vob
More file actions
executable file
·75 lines (68 loc) · 2.03 KB
/
Copy pathdvd2vob
File metadata and controls
executable file
·75 lines (68 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env zsh
#
# dvd2vob
# Reads out a DVD and dumps the content to a .vob file.
#
# helper functions
usage() {
echo
echo "Usage: $1 [Device] [Track-ID] [Output file]"
echo " Device = DVD device, should be either the symlink /dev/dvd"
echo " or something matching /dev/sr?"
echo " Track-ID = ID of the track that contains the movie. Use lsdvd to find it."
echo " Output file = File, where the dump is saved to. Should have .vob suffix."
echo
}
exit_usage() {
usage $1
exit 1
}
exit_file_exists() {
echo "dvd2vob: ERROR: Output file \"$1\" alreaddy exists! Aborting." >&2
exit 1
}
exit_mplayer_unavailable() {
echo "dvd2vob: FATAL: mplayer not in PATH." >&2
exit 1
}
# Check arguments
[ $# -eq 3 ] || exit_usage $0 # test if 3 arguments are passed
[ -b "$1" ] || exit_usage $0 # test if device really is a block special device
[ ! -e "$3" ] || exit_file_exists $3 # test it output file is not already there
# check if mplayer is available
which mplayer &>/dev/null || exit_mplayer_unavailable
# set up environment
DEVICE=$1
TRACK=$2
OUTPUT=$3
# if everything is correct, tell the user that that this could take a while,
# and give him a chance to abort it.
echo "dvd2vob: everything fine."
if [ "$RUNCONTEXT" \== "dvdrip" ]; then
true
else
echo "Everything looks fine, and therefore dvd2vob is"
echo "ready to start dumping."
echo
echo "Overview of what should be done:"
echo " Device where the DVD disk is:"
echo " -> $DEVICE"
echo "ID of the DVD track to dump:"
echo " -> $TRACK"
echo "Output file name:"
echo " -> $OUTPUT"
echo
echo "The actual dump can take a long time. This is the last"
echo "chance to abort the dump. Press Ctrl+C to abort,"
echo "otherwise, press ENTER to continue."
echo
read
fi
# start actual dump
echo "dvd2vob: Starting dump."
if [ "$RUNCONTEXT" \== "dvdrip" ]; then
mplayer dvd://$TRACK -dvd-device $DEVICE -dumpstream -dumpfile $OUTPUT >/dev/null || exit 1
else
mplayer dvd://$TRACK -dvd-device $DEVICE -dumpstream -dumpfile $OUTPUT || exit 1
fi
echo "dvd2vob: done."