You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
735 B
33 lines
735 B
#!/bin/bash
|
|
|
|
# Check if correct number of arguments is provided
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "Usage: $0 /path/to/font.ttf"
|
|
exit 1
|
|
fi
|
|
|
|
FONT_FILE="$1"
|
|
|
|
# Check if the font file exists
|
|
if [ ! -f "$FONT_FILE" ]; then
|
|
echo "Error: Font file not found!"
|
|
exit 1
|
|
fi
|
|
|
|
# Find and process all .mkv files
|
|
find . -type f -name "*.mkv" | while read -r mkv_file; do
|
|
echo "Processing: $mkv_file"
|
|
|
|
mkvpropedit "$mkv_file" \
|
|
--attachment-name "$(basename "$FONT_FILE")" \
|
|
--attachment-mime-type application/x-truetype-font \
|
|
--add-attachment "$FONT_FILE"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Successfully added font to: $mkv_file"
|
|
else
|
|
echo "Failed to add font to: $mkv_file"
|
|
fi
|
|
done
|
|
|