forked from rcraggs/reaper-auto-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto-render.sh
executable file
·55 lines (42 loc) · 1017 Bytes
/
auto-render.sh
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
#!/bin/bash
function render {
TEMP=$(mktemp /tmp/tmp.XXXXXXXX)
cp "$1" "$TEMP.RPP"
if [ ! -z "$preview" ]
then
sed -i.bak 's/RENDER_RANGE.*/RENDER_RANGE 0 0 30 16 1000/' "$TEMP.RPP"
fi
/Applications/REAPER64.app/Contents/MacOS/REAPER -renderproject "$TEMP.RPP"
}
source="."
destination="."
projects="latest"
preview=""
while getopts s:d:lap flag
do
case "${flag}" in
s) source=${OPTARG};;
d) destination=${OPTARG};;
l) projects="latest";;
a) projects="all" ;;
p) preview="true" ;;
esac
done
all_projects=""
for i in $(find $source -type f -name '*.RPP' | sed -r 's|/[^/]+$||' |sort |uniq); do
if [ $projects = "latest" ]; then
result=`ls -t $i/*.RPP | head -1`
all_projects="$all_projects\n$result"
else
result=`ls -1 $i/*.RPP`
all_projects="$all_projects\n$result"
fi
done
project_list=`echo -e "$all_projects"`
while IFS= read -r line; do
if [ ! -z "$line" ]
then
echo "Rendering: $line"
render "$line"
fi
done <<< "$project_list"