Skip to content

Commit

Permalink
Make sure that MP4Box is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeville committed Dec 26, 2024
1 parent 98748f2 commit b44a252
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/common/.local/bin/update-mp4-metadata
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

tool="MP4Box"

if [ -z "$1" ]; then
echo "Usage: $0 <input_file>"
exit 1
Expand All @@ -17,6 +19,11 @@ if [[ ${input_file##*.} != "mp4" ]]; then
exit 1
fi

if ! command -v $tool &>/dev/null; then
echo "Error: MP4Box is not installed. Please install it and try again."
exit 1
fi

allowed_langs=("en" "es" "fr" "he" "it" "ja" "ru" "sv")
read -r -p "Movie language (${allowed_langs[*]}): " lang_code

Expand All @@ -25,8 +32,6 @@ if [[ ! " ${allowed_langs[*]} " =~ $lang_code ]]; then
exit 1
fi

tool="MP4Box"

# Retrieve the IDs of all tracks in the file
track_ids=$("$tool" -info "$input_file" 2>&1 | grep '# Track' | awk '{print $3}')

Expand Down

0 comments on commit b44a252

Please sign in to comment.