strip_track_except: fix UNDESIRED_TRACK_COUNT

This commit is contained in:
Lukáš Kucharczyk 2022-10-08 16:23:30 +02:00
parent c33104c552
commit 8dcb77789d
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 2 additions and 2 deletions

View File

@ -17,8 +17,8 @@ TRACK_COUNT=$(echo "$JSON_OUTPUT" | jq length)
# check if more than 1 audio track is present # check if more than 1 audio track is present
[[ $TRACK_COUNT -lt 2 ]] && echo -e "\tFile has only 1 track, skipping." && exit 1 [[ $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 # 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=$(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 -eq 0 ]] && echo -e "\tFile has only '$LANGUAGE_TO_KEEP' tracks, skipping." && exit 1
FILENAME_EXT=${FILENAME##*.} FILENAME_EXT=${FILENAME##*.}
echo -e "\tRemoving all audio tracks except '$LANGUAGE_TO_KEEP' tracks..." echo -e "\tRemoving all audio tracks except '$LANGUAGE_TO_KEEP' tracks..."
TMPFILE=$(mktemp) TMPFILE=$(mktemp)