]> code.delx.au - transcoding/blob - mkvmerge-set-chapters
rip-dvd: don't extract iso to directory
[transcoding] / mkvmerge-set-chapters
1 #!/bin/bash -e
2
3 if [ -z "$1" -o -z "$2" ]; then
4 echo "Usage: $0 videodir chapterdir destdir"
5 exit 1
6 fi
7
8 videodir="$(cd "$1" && pwd)"
9 chapterdir="$(cd "$2" && pwd)"
10 destdir="$(cd "$3" && pwd)"
11
12 cd "$videodir"
13 find . -type f | while read infile; do
14 if [ ! -r "$infile" ]; then
15 echo "Missing file $infile"
16 exit 1
17 fi
18
19 outfile="${destdir}/${infile}"
20 if [ -e "$outfile" ]; then
21 echo "Skipping $infile, it already exists in destination directory!"
22 continue
23 fi
24
25 chapterfile="${chapterdir}/${infile}.chapters"
26 if [ ! -e "$chapterfile" ]; then
27 echo "Skipping $infile, no chapters!"
28 continue
29 fi
30
31 mkvmerge \
32 -o "$outfile" \
33 --chapters "${chapterfile}" \
34 --no-chapters \
35 "$infile"
36 done
37