parent
b795c0d001
commit
ac47243eb4
@ -0,0 +1,6 @@
|
|||||||
|
# TODO
|
||||||
|
[ ] Write script to remove images embedded in mkv
|
||||||
|
[ ] Write script to remove unwanted audio tracks in mkv
|
||||||
|
[ ] Write script to remove unwanted subtitle tracks in mkv
|
||||||
|
[ ] Write script to discard PGS subtitle tracks if ASS subtitle tracks exist
|
||||||
|
[ ] Write a script to make the first audio track in a language the default
|
||||||
@ -1,18 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Function to check attachments in a file
|
# Function to check if the file contains SSA/ASS subtitles
|
||||||
|
contains_ssa_ass() {
|
||||||
|
local file="$1"
|
||||||
|
if mkvmerge -i "$file" | grep -iqE "subtitles.*\(SSA\|ASS\)"; then
|
||||||
|
return 0 # Found SSA/ASS subtitles
|
||||||
|
else
|
||||||
|
return 1 # No SSA/ASS subtitles
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if the file has attachments
|
||||||
check_attachments() {
|
check_attachments() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
# Use mkvinfo to get the details of the file, specifically looking for 'attachments'
|
if ! mkvinfo "$file" | grep -q "Attachment"; then
|
||||||
if ! mkvmerge -i "$file" | grep -q "Attachment"; then
|
|
||||||
# If there are no attachments, print the filename
|
|
||||||
echo "$file"
|
echo "$file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Export the function so it can be used with find
|
export -f contains_ssa_ass
|
||||||
export -f check_attachments
|
export -f check_attachments
|
||||||
|
|
||||||
# Recursively find all .mkv files and check for attachments
|
# Find all .mkv files and process them
|
||||||
find . -type f -name "*.mkv" -exec bash -c 'check_attachments "$0"' {} \;
|
find . -type f -name "*.mkv" | while read -r file; do
|
||||||
|
if contains_ssa_ass "$file"; then
|
||||||
|
check_attachments "$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|||||||
Loading…
Reference in new issue