From 8dcb77789d3de80e50b17aeb16e850a6ebffb32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sat, 8 Oct 2022 16:23:30 +0200 Subject: [PATCH] strip_track_except: fix UNDESIRED_TRACK_COUNT --- strip_track_except.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strip_track_except.sh b/strip_track_except.sh index a5b8a07..353c654 100755 --- a/strip_track_except.sh +++ b/strip_track_except.sh @@ -17,8 +17,8 @@ TRACK_COUNT=$(echo "$JSON_OUTPUT" | jq length) # check if more than 1 audio track is present [[ $TRACK_COUNT -lt 2 ]] && echo -e "\tFile has only 1 track, skipping." && exit 1 # check if tracks other than the one to keep are present -UNDESIRED_TRACK_COUNT=$(echo "$JSON_OUTPUT" | jq '[.[] | select(.properties.language!="$LANGUAGE_TO_KEEP")] | length') -[[ $UNDESIRED_TRACK_COUNT -lt 2 ]] && echo -e "\tFile has only '$LANGUAGE_TO_KEEP' tracks, skipping." && exit 1 +UNDESIRED_TRACK_COUNT=$(echo "$JSON_OUTPUT" | jq "[.[] | select(.properties.language!=\"${LANGUAGE_TO_KEEP}\")] | length") +[[ $UNDESIRED_TRACK_COUNT -eq 0 ]] && echo -e "\tFile has only '$LANGUAGE_TO_KEEP' tracks, skipping." && exit 1 FILENAME_EXT=${FILENAME##*.} echo -e "\tRemoving all audio tracks except '$LANGUAGE_TO_KEEP' tracks..." TMPFILE=$(mktemp)