summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common-playbook.yml5
-rw-r--r--group_vars/all.yml1
-rw-r--r--roles/caption/defaults/main.yml1
-rw-r--r--roles/caption/tasks/main.yml14
-rwxr-xr-xroles/caption/templates/reencode.sh43
-rw-r--r--roles/prerec/tasks/main.yml28
-rwxr-xr-xroles/prerec/templates/process-prerec.sh (renamed from roles/caption/templates/process-prerec.sh)0
-rwxr-xr-xroles/prerec/templates/run-aeneas.sh (renamed from roles/caption/templates/run-aeneas.sh)0
-rwxr-xr-xroles/prerec/templates/update-task-status.sh (renamed from roles/caption/templates/update-task-status.sh)0
-rwxr-xr-xroles/prerec/templates/upload.sh (renamed from roles/caption/templates/upload.sh)0
10 files changed, 34 insertions, 58 deletions
diff --git a/common-playbook.yml b/common-playbook.yml
index a3377ea..463c411 100644
--- a/common-playbook.yml
+++ b/common-playbook.yml
@@ -41,6 +41,11 @@
name: stream
tasks_from: test
when: icecast_test is defined and icecast_test=='file'
+- name: Set up prerec processing workflow
+ hosts: res
+ tags: prerec
+ roles:
+ - prerec
- name: Set up captioning tools
hosts: res
tags: caption
diff --git a/group_vars/all.yml b/group_vars/all.yml
index 925a944..d3c2e7b 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
@@ -29,3 +29,4 @@ emacs_config_dir: ~{{ emacsconf_user }}/.emacs.d
emacsconf_el_dir: ~{{ emacsconf_user }}/emacsconf-el
emacsconf_edit_wiki_dir: ~{{ emacsconf_user }}/emacsconf-wiki
emacsconf_private_dir: ~{{ emacsconf_user }}/emacsconf-2022-private
+emacsconf_caption_dir: /data/emacsconf/{{ emacsconf_year }}
diff --git a/roles/caption/defaults/main.yml b/roles/caption/defaults/main.yml
index c158118..8b13789 100644
--- a/roles/caption/defaults/main.yml
+++ b/roles/caption/defaults/main.yml
@@ -1,2 +1 @@
-emacsconf_caption_dir: /data/emacsconf/{{ emacsconf_year }}
diff --git a/roles/caption/tasks/main.yml b/roles/caption/tasks/main.yml
index a69d848..ab49c00 100644
--- a/roles/caption/tasks/main.yml
+++ b/roles/caption/tasks/main.yml
@@ -34,17 +34,6 @@
state: directory
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
-- name: Recreate encoding script
- tags: process-prerec
- template:
- src: "{{ item }}"
- dest: "{{ emacsconf_caption_dir }}/scripts/{{ item }}"
- owner: "{{ emacsconf_user }}"
- group: "{{ emacsconf_group }}"
- force: no
- mode: 0775
- loop:
- - reencode.sh
- name: Copy scripts for processing
tags: process-prerec
template:
@@ -55,9 +44,6 @@
mode: 0775
loop:
- process-captions.py
- - process-prerec.sh
- - update-task-status.sh
- - upload.sh
- run-aeneas.sh
# - name: Copy the inotify script
# tags: process-captions
diff --git a/roles/caption/templates/reencode.sh b/roles/caption/templates/reencode.sh
deleted file mode 100755
index e3a82eb..0000000
--- a/roles/caption/templates/reencode.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-# Defaults
-q=32
-cpu=4
-time_limit=""
-print_only=false
-
-while getopts :q:c:t:s OPT; do
- case $OPT in
- q|+q)
- q="$OPTARG"
- ;;
- c|+c)
- cpu="$OPTARG"
- ;;
- t|+t)
- time_limit="-to $OPTARG"
- ;;
- s)
- print_only=true
- ;;
- *)
- echo "usage: `basename $0` [+-q ARG] [+-c ARG} [--] ARGS..."
- exit 2
- esac
-done
-shift `expr $OPTIND - 1`
-OPTIND=1
-
-command="$(cat<<EOF
-ffmpeg -y -i "$1" $time_limit -c:v libvpx-vp9 -b:v 0 -crf $q -an -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -g 240 -pass 1 -f webm -threads $cpu /dev/null &&
- ffmpeg -y -i "$1" $time_limit -c:v libvpx-vp9 -b:v 0 -crf $q -c:a libopus -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -pass 2 -g 240 -threads $cpu "$2"
-EOF
-)"
-
-if [ $print_only == true ]; then
- echo "$command"
-else
- eval "$command"
-fi
diff --git a/roles/prerec/tasks/main.yml b/roles/prerec/tasks/main.yml
new file mode 100644
index 0000000..5241531
--- /dev/null
+++ b/roles/prerec/tasks/main.yml
@@ -0,0 +1,28 @@
+- name: Ensure the directory exists
+ file:
+ path: "{{ emacsconf_caption_dir }}/scripts"
+ state: directory
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+- name: Recreate encoding script only if it's not there
+ tags: process-prerec
+ template:
+ src: "reencode.sh"
+ dest: "{{ emacsconf_caption_dir }}/scripts/reencode.sh"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ # This avoids overwriting zaeph's
+ force: no
+ mode: 0775
+- name: Copy scripts for processing
+ tags: process-prerec
+ template:
+ src: "{{ item }}"
+ dest: "{{ emacsconf_caption_dir }}/scripts/{{ item }}"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ mode: 0775
+ loop:
+ - process-prerec.sh
+ - update-task-status.sh
+ - upload.sh
diff --git a/roles/caption/templates/process-prerec.sh b/roles/prerec/templates/process-prerec.sh
index e49aa72..e49aa72 100755
--- a/roles/caption/templates/process-prerec.sh
+++ b/roles/prerec/templates/process-prerec.sh
diff --git a/roles/caption/templates/run-aeneas.sh b/roles/prerec/templates/run-aeneas.sh
index 6f40134..6f40134 100755
--- a/roles/caption/templates/run-aeneas.sh
+++ b/roles/prerec/templates/run-aeneas.sh
diff --git a/roles/caption/templates/update-task-status.sh b/roles/prerec/templates/update-task-status.sh
index 18b7c1b..18b7c1b 100755
--- a/roles/caption/templates/update-task-status.sh
+++ b/roles/prerec/templates/update-task-status.sh
diff --git a/roles/caption/templates/upload.sh b/roles/prerec/templates/upload.sh
index f723d29..f723d29 100755
--- a/roles/caption/templates/upload.sh
+++ b/roles/prerec/templates/upload.sh