Fixed bug in having -s override Handbrake preset bitrates
[rip_dvd/.git] / rip_dvd.wrap
index 09ba254ffeed64e59387320b41141965d27b64c4..fdfee25d0fac2aa0407d57251f9ed82cbc2de49b 100755 (executable)
@@ -25,8 +25,27 @@ fi
 # in a way that won't get clobbered when you pull updates from my GIT repo.
 ##############################################################################
 config="${0%/*}/rip_dvd.conf"
-[ -e "${config}.dist" ] && . ${config}.dist
-[ -e "${config}" ] && . ${config}
+
+# The config file will be searched for in the following location order:
+found_config=0
+
+# 1) /path/to/rip_dvd/script/rip_dvd.conf.dist
+[ -e "${config}.dist" ] && found_config=1 && . "${config}.dist"
+
+# 2) /path/to/rip_dvd/script/rip_dvd.conf
+[ -e "${config}" ] && found_config=1 && . "${config}"
+
+# 3) /etc/rip_dvd.conf
+[ -e "/etc/rip_dvd.conf" ] && found_config=1 && . "/etc/rip_dvd.conf"
+
+# 4) $PWD/rip_dvd.conf
+[ -e "$PWD/rip_dvd.conf" ] && found_config=1 && . "$PWD/rip_dvd.conf"
+
+# Check to make sure we found the config file
+if [ $found_config -eq 0 ]; then
+  echo "-E- Unable to find the rip_dvd.conf file: $config"
+  exit 1
+fi
 
 ##############################################
 # get the name of the DVD from the DVD disk