From 5bf4ab50e13a9be2923ddebe69525b40df8ab3bc Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 5 Nov 2022 08:02:44 -0400 Subject: Separate caption and prerec roles --- roles/caption/defaults/main.yml | 1 - roles/caption/tasks/main.yml | 14 --------- roles/caption/templates/process-prerec.sh | 18 ----------- roles/caption/templates/reencode.sh | 43 --------------------------- roles/caption/templates/run-aeneas.sh | 14 --------- roles/caption/templates/update-task-status.sh | 10 ------- roles/caption/templates/upload.sh | 6 ---- roles/prerec/tasks/main.yml | 28 +++++++++++++++++ roles/prerec/templates/process-prerec.sh | 18 +++++++++++ roles/prerec/templates/run-aeneas.sh | 14 +++++++++ roles/prerec/templates/update-task-status.sh | 10 +++++++ roles/prerec/templates/upload.sh | 6 ++++ 12 files changed, 76 insertions(+), 106 deletions(-) delete mode 100755 roles/caption/templates/process-prerec.sh delete mode 100755 roles/caption/templates/reencode.sh delete mode 100755 roles/caption/templates/run-aeneas.sh delete mode 100755 roles/caption/templates/update-task-status.sh delete mode 100755 roles/caption/templates/upload.sh create mode 100644 roles/prerec/tasks/main.yml create mode 100755 roles/prerec/templates/process-prerec.sh create mode 100755 roles/prerec/templates/run-aeneas.sh create mode 100755 roles/prerec/templates/update-task-status.sh create mode 100755 roles/prerec/templates/upload.sh (limited to 'roles') 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/process-prerec.sh b/roles/caption/templates/process-prerec.sh deleted file mode 100755 index e49aa72..0000000 --- a/roles/caption/templates/process-prerec.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# {{ ansible_managed }} - -ORIGINAL=$1 -REENCODED=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1reencoded.webm/') -SLUG=$(echo "$ORIGINAL" | perl -ne '/^emacsconf-[0-9]*-(.*?)--/ && print $1') -MAIN=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1main.webm/') -SCREEN=reencode-$SLUG -if ! ( screen -ls | grep -q $SLUG ); then - screen -dmS $SCREEN -fi -( cd /data/emacsconf/cache; ./update-cache ) -/data/emacsconf/2022/scripts/update-task-status.sh $SLUG "WAITING_FOR_PREREC" "PROCESSING" -#if [[ ! -f "$REENCODED" ]]; then -screen -S $SCREEN -X screen -t reencode-$SLUG /bin/bash -c "/data/emacsconf/2022/scripts/reencode.sh \"$ORIGINAL\" \"$REENCODED\" && /data/emacsconf/2022/scripts/upload.sh $REENCODED && exec /bin/bash" & -#fi -screen -S $SCREEN -X screen -t captions-$SLUG /bin/bash -c "/data/emacsconf/2022/scripts/process-captions.py $(dirname $ORIGINAL); /data/emacsconf/2022/scripts/update-task-status.sh $SLUG PROCESSING TO_ASSIGN; exec /bin/bash" -screen -x $SCREEN 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<