Added new logging feature that will log the rip_dvd cmd in the logfile
[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 ##############################################################################
20 # Local Machine Settings:
21 # Sources both the "default" conf file tracked by GIT (rip_dvd.conf.dist)
22 # and the local conf file created by each local machine (rip_dvd.conf)
23 # Copy the rip_dvd.conf.dist file to rip_dvd.conf and edit the later.
24 # This will allow you to override all the default values to meet your needs
25 # in a way that won't get clobbered when you pull updates from my GIT repo.
26 ##############################################################################
27 config="${0%/*}/rip_dvd.conf"
28 [ -e "${config}.dist" ] && . ${config}.dist
29 [ -e "${config}" ] && . ${config}
30
31 ##############################################
32 # get the name of the DVD from the DVD disk
33 dvdname=`volname $dev | awk '{ print $1 }'`
34 dvdname=${dvdname%.} # remove trailing '.' character
35
36 ##############################################
37 # Find out what type of DVD we are ripping
38 # And set our destination directory appropriately
39 # dvdtype parameter:
40 # - netflix = DVD ripped as an entire ISO image
41 #   since these are only kept around until we watch them,
42 #   there is no need to do anything less than full iso.
43 # - collection = Only DVD main feature is ripped
44 # - childrens = Only DVD main feature is ripped
45 # - church = Only DVD main feature is ripped
46 rip_opts="$*"
47 if [ "$dvdtype" == "netflix" ]; then
48   echo "-> Ripping Netflix DVD"
49   dest=/myth/video/DVDs/Netflix
50   rip_opts="$rip_opts"
51 elif [ "$dvdtype" == "collection" ]; then
52   echo "-> Ripping Personal Collection DVD"
53   dest=/myth/video/DVDs/Collection
54   rip_opts="$rip_opts"
55 elif [ "$dvdtype" == "childrens" ]; then
56   echo "-> Ripping Children's DVD"
57   dest=/myth/video/DVDs/Childrens
58   rip_opts="$rip_opts"
59 elif [ "$dvdtype" == "church" ]; then
60   echo "-> Ripping Church DVD"
61   dest=/myth/video/DVDs/Church
62   rip_opts="$rip_opts"
63 else
64   echo '-E- Must specify dvdtype as "netflix" or "collection" or "childrens" or "church"'
65   usage
66 fi
67
68 ##############################################
69 # Display progress window
70
71 # Pop up an xterm window and run the script inside of it
72 echo "xterm -T \"Ripping->$dvdname\" -geometry 72x15+20+10 -bg black -fg white -e \"/bin/bash\" -c \"$ripcmd -d $dest $rip_opts\" &"
73 xterm -T "Ripping->$dvdname" -geometry 72x15+20+10 -bg black -fg white -e "/bin/bash" -c "$ripcmd -d $dest $rip_opts" &
74
75 ##############################################
76 # OR display the script output directly in the terminal it's called from
77 #$ripcmd -d $dest $rip_opts
78
79 ##############################################