31 lines
529 B
Bash
Executable file
31 lines
529 B
Bash
Executable file
#!/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"
|