Synched gist at Sat Jun 1 12:42:54 PDT 2024

This commit is contained in:
Marco Cawthorne 2024-06-01 12:42:54 -07:00
parent f145e15d22
commit 067aac34db
Signed by: eukara
GPG key ID: CE2032F0A2882A22

31
mlt-isolate Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
strip_track()
{
xmlstarlet ed -d "//mlt/playlist[@id='playlist"$2"']" "$1" > /tmp/out.mlt
sed -i '/playlist'$2'/d' /tmp/out.mlt
cp /tmp/out.mlt /tmp/input.mlt
}
INPUT_FILE="$1"
TRACK_TO_KEEP="$2"
MAX_TRACKS="$3"
# copy it for safe keeping.
cp "$1" /tmp/input.mlt
COUNTER=0
for OUTPUT in $(seq $MAX_TRACKS)
do
if [ ! $COUNTER = $TRACK_TO_KEEP ]
then
strip_track /tmp/input.mlt $COUNTER
fi
let COUNTER++
done
sed -i 's/playlist'$TRACK_TO_KEEP'/playlist0/g' /tmp/out.mlt
cp /tmp/out.mlt "$1.isolated.mlt"