Synched gist at Sat Jun 1 12:42:54 PDT 2024
This commit is contained in:
parent
f145e15d22
commit
067aac34db
1 changed files with 31 additions and 0 deletions
31
mlt-isolate
Executable file
31
mlt-isolate
Executable 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"
|
Loading…
Reference in a new issue