##############################################################################################
# Command line processing
##############################################################################################
-while (($#)) && getopts 162mvifkzx:ht:n:d:b:s:t:a:p:e:j:l: opt "$@"
+while (($#)) && getopts 162wmvifkzx:ht:n:d:b:s:t:a:p:e:j:l: opt "$@"
do
case $opt in
(n) dvdname=$OPTARG;;
(x) extension=$OPTARG;;
(j) eject_disk=$OPTARG;;
(l) aid_override=$OPTARG;;
- (w) set -$opt;;
+ (w) set -x;;
(h) show_usage=1;;
(:) echo >&2 "$0: $OPTARG requires a value"; errors=errors+1;;
(\?) echo >&2 "$0: invalid option '$OPTARG'"; errors=errors+1;;
typeset handbrake_video_encoder_opts=""
typeset filetype=""
typeset handbrake_audio_opts=""
+ typeset hb_profile=""
# Set a variable that we will use later to determine if we found a handler for $profile or not
typeset -i found_profile=0
# extract the HandBrake Profile name from $profile
hb_profile=`echo "$profile" | sed 's/hb_//g' | sed 's/_/ /g'`
- handbrake_opts[0]="-Z \"$hb_profile\""
fi
# Make sure we found a handler for the given profile
done
# Execute the handbrake command to encode the video
- echo -e "\n Encoding: $handbrake_cli -i \"$vobfile\" -o \"$final_output_file\" $handbrake_cmd_line_opts $handbrake_audio_opts $handbrake_video_encoder_opts $PASSES >> $encodelog 2>&1" >> "$logfile"
- $handbrake_cli -i "$vobfile" -o "$final_output_file" $handbrake_cmd_line_opts $handbrake_audio_opts $handbrake_video_encoder_opts $PASSES >> $encodelog 2>&1
- handbrake_retval=$?
+ if [ -n "$hb_profile" ]; then
+ echo -e "\n Encoding: $handbrake_cli -i \"$vobfile\" -o \"$final_output_file\" -Z \"$hb_profile\" $handbrake_cmd_line_opts $handbrake_audio_opts $handbrake_video_encoder_opts $PASSES >> $encodelog 2>&1" >> "$logfile"
+ $handbrake_cli -i "$vobfile" -o "$final_output_file" -Z "$hb_profile" $handbrake_cmd_line_opts $handbrake_audio_opts $handbrake_video_encoder_opts $PASSES >> $encodelog 2>&1
+ handbrake_retval=$?
+ else
+ echo -e "\n Encoding: $handbrake_cli -i \"$vobfile\" -o \"$final_output_file\" $handbrake_cmd_line_opts $handbrake_audio_opts $handbrake_video_encoder_opts $PASSES >> $encodelog 2>&1" >> "$logfile"
+ $handbrake_cli -i "$vobfile" -o "$final_output_file" $handbrake_cmd_line_opts $handbrake_audio_opts $handbrake_video_encoder_opts $PASSES >> $encodelog 2>&1
+ handbrake_retval=$?
+ fi
if [ $handbrake_retval != 0 ]; then
fatal_and_exit "-E- Unhandled handbrake error"
fi