From e3a604e459d41151a7a636588069816ce24d2c76 Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Thu, 7 Nov 2019 00:06:38 -0800 Subject: [PATCH] Fix issue where mkvalanyze always asked for new title when using -f flag --- bin/mkvanalyze | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/mkvanalyze b/bin/mkvanalyze index eb58d2c..94b47ec 100755 --- a/bin/mkvanalyze +++ b/bin/mkvanalyze @@ -122,12 +122,8 @@ while IFS= read -rd '' file <&3; do # Check title title=$(echo "$file_info" | grep 'Title:' | sed 's/.* Title: \(.*\)$/\1/') + title_issue=0 if [[ -z "$title" || $flag_t -eq 1 ]]; then - if [[ -z "$title" ]]; then - print_filename_once - echo "Title Missing" - fi - # Generate a new title to recommend new_title="$(basename "$file")" # get the filename new_title="${new_title%.*}" # remove the extension @@ -144,12 +140,21 @@ while IFS= read -rd '' file <&3; do new_title="${new_title##*S[0-9][0-9]E[0-9][0-9] - }" fi + # If title is empty + if [[ -z "$title" ]]; then + title_issue=1 + print_filename_once + echo "Title Missing" + fi + + # If actual title doesn't match recommended title and we care about that if [[ $flag_t -eq 1 && "$title" != "$new_title" ]]; then + title_issue=1 print_filename_once - echo "Title does not match recommended title [$new_title]" + echo "Actual title [$title] does not match recommended title [$new_title]" fi - if [[ $flag_f -eq 1 ]]; then + if [[ $title_issue -eq 1 && $flag_f -eq 1 ]]; then echo -n "Enter a title, or s to skip [$new_title]: " read -e user_title new_title="${user_title:-$new_title}" -- GitLab