-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathauto.sh
More file actions
executable file
·60 lines (53 loc) · 1.34 KB
/
Copy pathauto.sh
File metadata and controls
executable file
·60 lines (53 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
source functions.sh
#ffmpeg -bsf:v h264_mp4toannexb -sn -vcodec libx264 "$i.ts"
# store cutlist.at url to file
filename=/root/.cutlist.at
if [ -a "$filename" ]; then
rm "$filename"
fi
touch "$filename"
echo ${cutlistAtUrl} >> "$filename"
# decode
if [ "${skipDecode}" != "true" ]; then
for keyFile in /otr/*.otrkey
do
echo "Processing: $keyFile"
decode $keyFile
done
else
echo "decode skipped"
fi
# cut
if [ "${skipCut}" != "true" ]; then
for decodedFile in /otr/*.avi
do
mc $decodedFile
done
else
echo "cut skipped"
fi
# convert
if [ "${convert}" != "false" ] && [ "${skipConvert}" != "true" ]; then
resultFileType=".m4v"
for cutFile in /otr/cut/*.avi
do
convert "${cutFile}" "${cutFile}.m4v"
done
else
echo "convert skipped"
resultFileType=".avi"
fi
# cleanup (only if success)
countOtr=`ls -1 *.otrkey 2>/dev/null | wc -l`
countResult=`ls -1 cut/*${resultFileType} 2>/dev/null | wc -l`
if [ "${skipCleanup}" != "true" ] && [ $countOtr == $countResult ] && [ `wc -c cut/*${resultFileType} | tail -n 1 | cut -c8-9` != "0" ]; then
echo "cleanup"
rm -f *.otrkey
mv cut/*${resultFileType} ./
rm -rf cut uncut decoded
elif [ "${skipCleanup}" == "true" ]; then
echo "cleanup skipped, keeping intermediate files"
else
echo "something went wrong, keeping intermediate files"
fi