summaryrefslogblamecommitdiffstats
path: root/roles/prerec/templates/reencode-in-screen.sh
blob: 5c122030c863b10d9b9390ed8181341fea696cd4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                                                                            
#!/bin/bash
ORIGINAL=$1
BASE="${ORIGINAL%--original.*}"
REENCODED="${BASE}--reencoded.webm"
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