Add another note about libdvdcss
[rip_dvd/.git] / rip_dvd.wrap
1 #!/bin/bash
2
3 ##############################################
4 # COMMAND LINE PROCESSING
5
6 # get the dvdtype from the command line
7 dvdtype=$1
8
9 # remove the dvdtype from the args, and interpret the rest
10 # of the args to be passed directly to the rip_dvd script.
11 shift 1
12
13 ##############################################
14 if [ -z "$dvdtype" ]; then
15   echo "-E- $0 <dvdtype>' is a required option"
16   usage
17 fi
18
19 mydir=$(cd $(dirname $0) && pwd)
20 if [ -z "$ripcmd" ]
21 then
22   if [ -x "$mydir/rip_dvd" ]
23   then
24     ripcmd="$mydir/rip_dvd"
25   else
26     echo >&2 "Cannot find your rip_dvd command!"
27     exit 1
28   fi
29 fi
30
31 ##############################################################################
32 # Local Machine Settings:
33 # Sources both the "default" conf file tracked by GIT (rip_dvd.conf.dist)
34 # and the local conf file created by each local machine (rip_dvd.conf)
35 # Copy the rip_dvd.conf.dist file to rip_dvd.conf and edit the later.
36 # This will allow you to override all the default values to meet your needs
37 # in a way that won't get clobbered when you pull updates from my GIT repo.
38 ##############################################################################
39 config="${0%/*}/rip_dvd.conf"
40
41 # The config file will be searched for in the following location order:
42 found_config=0
43
44 # 1) /path/to/rip_dvd/script/rip_dvd.conf.dist
45 [ -e "${config}.dist" ] && found_config=1 && . "${config}.dist"
46
47 # 2) /path/to/rip_dvd/script/rip_dvd.conf
48 [ -e "${config}" ] && found_config=1 && . "${config}"
49
50 # 3) /etc/rip_dvd.conf
51 [ -e "/etc/rip_dvd.conf" ] && found_config=1 && . "/etc/rip_dvd.conf"
52
53 # 4) $PWD/rip_dvd.conf
54 [ -e "$PWD/rip_dvd.conf" ] && found_config=1 && . "$PWD/rip_dvd.conf"
55
56 # Check to make sure we found the config file
57 if [ $found_config -eq 0 ]; then
58   echo "-E- Unable to find the rip_dvd.conf file: $config"
59   exit 1
60 fi
61
62 ##############################################
63 # get the name of the DVD from the DVD disk
64 dvdname=`volname $dev | awk '{ print $1 }'`
65 dvdname=${dvdname%.} # remove trailing '.' character
66
67 ##############################################
68 # Find out what type of DVD we are ripping
69 # And set our destination directory appropriately
70 # dvdtype parameter:
71 # - netflix = DVD ripped as an entire ISO image
72 #   since these are only kept around until we watch them,
73 #   there is no need to do anything less than full iso.
74 # - collection = Only DVD main feature is ripped
75 # - childrens = Only DVD main feature is ripped
76 # - church = Only DVD main feature is ripped
77 rip_opts="$* -j 2"
78 if [ "$dvdtype" == "netflix" ]; then
79   echo "-> Ripping Netflix DVD"
80   dest=/myth/video/DVDs/Netflix
81   rip_opts="$rip_opts"
82 elif [ "$dvdtype" == "collection" ]; then
83   echo "-> Ripping Personal Collection DVD"
84   dest=/myth/video/DVDs/Collection
85   rip_opts="$rip_opts"
86 elif [ "$dvdtype" == "childrens" ]; then
87   echo "-> Ripping Children's DVD"
88   dest=/myth/video/DVDs/Childrens
89   rip_opts="$rip_opts"
90 elif [ "$dvdtype" == "church" ]; then
91   echo "-> Ripping Church DVD"
92   dest=/myth/video/DVDs/Church
93   rip_opts="$rip_opts"
94 else
95   echo '-E- Must specify dvdtype as "netflix" or "collection" or "childrens" or "church"'
96   usage
97 fi
98
99 ##############################################
100 # Display progress window
101
102 # Pop up an xterm window and run the script inside of it
103 echo "xterm -T \"Ripping->$dvdname\" -geometry 72x15+20+10 -bg black -fg white -e \"/bin/bash\" -c \"$ripcmd -d $dest $rip_opts\" &"
104 xterm -T "Ripping->$dvdname" -geometry 72x15+20+10 -bg black -fg white -e "/bin/bash" -c "$ripcmd -d $dest $rip_opts" &
105
106 ##############################################
107 # OR display the script output directly in the terminal it's called from
108 #$ripcmd -d $dest $rip_opts
109
110 ##############################################