#!/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