summaryrefslogtreecommitdiffstats
path: root/roles/prerec
diff options
context:
space:
mode:
Diffstat (limited to 'roles/prerec')
-rw-r--r--roles/prerec/tasks/main.yml3
-rwxr-xr-xroles/prerec/templates/reencode-in-screen.sh16
2 files changed, 18 insertions, 1 deletions
diff --git a/roles/prerec/tasks/main.yml b/roles/prerec/tasks/main.yml
index 5b39977..a0a3cac 100644
--- a/roles/prerec/tasks/main.yml
+++ b/roles/prerec/tasks/main.yml
@@ -68,10 +68,11 @@
- verify-main.sh
- remux.sh
- get-file-prefix
+ - reencode-in-screen.sh
- name: Copy Makefile
+ tags: process-prerec, prerec-scripts, prerec-make
template:
src: Makefile
dest: "{{ emacsconf_caption_dir }}/cache/Makefile"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
-
diff --git a/roles/prerec/templates/reencode-in-screen.sh b/roles/prerec/templates/reencode-in-screen.sh
new file mode 100755
index 0000000..5c12203
--- /dev/null
+++ b/roles/prerec/templates/reencode-in-screen.sh
@@ -0,0 +1,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