summaryrefslogtreecommitdiffstats
path: root/roles/prerec/templates/reencode-in-screen.sh
blob: 711957248733e2ab43a7d3e19e839a386f25bb21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
ORIGINAL=$1
BASE="${ORIGINAL%--original.*}"
if [ -n "$2" ]; then
    REENCODED=$2
else
    REENCODED="${BASE}--reencoded.webm"
fi
SLUG=$(echo "$ORIGINAL" | perl -ne '/^emacsconf-[0-9]*-(.*?)--/ && print $1')
LOCK=".lock-$SLUG"

if [ ! -f "$REENCODED" ]; then
		if [  -f "$LOCK" ]; then
				echo "$LOCK already exists, waiting for it"
		else
				touch "$LOCK"
				screen -dmS reencode-$SLUG /bin/bash -c "reencode.sh \"$ORIGINAL\" \"$REENCODED\" && thumbnail.sh \"$MAIN\" && rm \"$LOCK\""
				echo "Processing $REENCODED in reencode-$SLUG"
		fi
fi