littlejeem / control_scripts

A collection of scripts that control functions, primarily on my media pc
GNU General Public License v3.0
0 stars 0 forks source link

BD_Ripping.sh #12

Closed littlejeem closed 2 years ago

littlejeem commented 2 years ago

The logic in the following section is flawed

#TEST RESULTS TO SEE WHICH TO CHOOSE AND IF DIFFERENT TO OUT AUTO FIND TITLE WE NEED TO RECREATE main_feature_scan.json BEFORE AUDIO CHECK
if [[ -z "$title1" && -z "$title2" ]]; then
  edebug "no online data to use, so using local data"
elif [[ "$title1" != "$auto_found_main_feature" && "$title2" != "$auto_found_main_feature" ]]; then
  edebug "online check resulted in titles $title1 & $title2, matching online runtime but NOT, handbrakes automatically found main feature: $auto_found_main_feature, using title2"
  #we choose title 2 when there are 2 detected as this better than 50% right most of the time imo.
  mv main_feature_scan.json main_feature_scan.json.original
  auto_found_main_feature=$(echo $title2)
  HandBrakeCLI --json -i $source_loc -t $auto_found_main_feature --scan 1> main_feature_scan.json 2> /dev/null
  clean_main_feature_scan
elif [[ "$title1" == "$auto_found_main_feature" && "$title2" == "$auto_found_main_feature" ]]; then
  edebug "online check resulted in both titles, matching handbrakes automatically found main feature: $auto_found_main_feature. Using title2"
  #we choose title 2 when there are 2 detected as this better than 50% right most of the time imo.
  mv main_feature_scan.json main_feature_scan.json.original
  auto_found_main_feature=$(echo $title2)
  HandBrakeCLI --json -i $source_loc -t $auto_found_main_feature --scan 1> main_feature_scan.json 2> /dev/null
  clean_main_feature_scan
elif [[ "$title1" != "$auto_found_main_feature" && "$title2" == "$auto_found_main_feature" ]]; then
  edebug "online check resulted in title2, matching handbrakes automatically found main feature $auto_found_main_feature, using title2"
  mv main_feature_scan.json main_feature_scan.json.original
  auto_found_main_feature=$(echo $title2)
  HandBrakeCLI --json -i $source_loc -t $auto_found_main_feature --scan 1> main_feature_scan.json 2> /dev/null
  clean_main_feature_scan
elif [[ "$title1" == "$auto_found_main_feature" && "$title2" != "$auto_found_main_feature" ]]; then
  #then title 1 is set but if $title2 is valid $title2 is set
  edebug "${red_highlight} online check resulted in only title1 matching handbrakes automatically found main feature, using"
fi

This section from the above presumes that $title_1 & $title_2 will be set but they won't if script doesn't match more than one title in the runtime search prior.

elif [[ "$title1" != "$auto_found_main_feature" && "$title2" != "$auto_found_main_feature" ]]; then
  edebug "online check resulted in titles $title1 & $title2, matching online runtime but NOT, handbrakes automatically found main