delete_video_track_titles: add more information

This commit is contained in:
Lukáš Kucharczyk 2022-10-07 22:28:28 +02:00
parent 17574160da
commit 9d435e9216
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 14 additions and 6 deletions

View File

@ -13,13 +13,21 @@ JSON_OUTPUT=$(mkvmerge -J "$FILE" | jq '.tracks[] | del(.properties.codec_privat
echo -n "Processing "
colorprint "$FILE"
for TRACK in $TRACKS; do
TRACK_NAME=$(echo "$JSON_OUTPUT" | jq "select(.id == $TRACK).properties.track_name")
echo -n "Track no. ${TRACK} currently set to $TRACK_NAME... "
TRACK_DATA=$(echo "$JSON_OUTPUT" | jq "select(.id == $TRACK)")
TRACK_NAME=$(echo "$TRACK_DATA" | jq ".properties.track_name")
TRACK_TYPE=$(echo "$TRACK_DATA" | jq ".type")
TRACK_CODEC=$(echo "$TRACK_DATA" | jq ".codec")
TRACK_LANGUAGE=$(echo "$TRACK_DATA" | jq ".properties.language")
echo -en "\tTrack no. ${TRACK} (${TRACK_TYPE}, ${TRACK_CODEC}, ${TRACK_LANGUAGE})... "
[[ $TRACK_NAME == "null" ]] && echo "has no title, skipping." && continue
echo -n "currently set to $TRACK_NAME... "
shopt -s nocasematch
[[ $TRACK_NAME =~ full|\stitles|comment|director|sdh|sign ]] && echo "includes whitelisted word, not deleting." && continue
echo "deleting."
echo -n "deleting... "
# mkvmerge --identify indexes tracks from 0, while mkvpropedit indexes from 1
mkvpropedit "$FILE" --edit track:"$((TRACK+1))" --delete name
mkvpropedit "$FILE" --edit track:"$((TRACK+1))" --delete name &>/dev/null
echo "done."
done
echo "Deleting file title..."
mkvpropedit "$FILE" --edit info --delete title
echo -en "\tDeleting file title... "
mkvpropedit "$FILE" --edit info --delete title &>/dev/null
echo "done."