From 66ae0b351fe2709d583073496f3ff6812989cdd2 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 2 Dec 2022 08:18:56 -0500 Subject: prerec updates --- roles/prerec/defaults/main.yml | 2 ++ roles/prerec/tasks/main.yml | 11 +++++------ roles/prerec/templates/process-prerec.sh | 4 ++-- roles/prerec/templates/reencode.sh | 8 ++++---- roles/prerec/templates/talk | 21 +++++++++++++++++++++ roles/prerec/templates/update-task-status.sh | 21 --------------------- 6 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 roles/prerec/defaults/main.yml create mode 100755 roles/prerec/templates/talk delete mode 100755 roles/prerec/templates/update-task-status.sh (limited to 'roles/prerec') diff --git a/roles/prerec/defaults/main.yml b/roles/prerec/defaults/main.yml new file mode 100644 index 0000000..3668655 --- /dev/null +++ b/roles/prerec/defaults/main.yml @@ -0,0 +1,2 @@ +reencode_quality: 32 +reencode_cpu: 4 diff --git a/roles/prerec/tasks/main.yml b/roles/prerec/tasks/main.yml index 954c5a7..e44617d 100644 --- a/roles/prerec/tasks/main.yml +++ b/roles/prerec/tasks/main.yml @@ -24,22 +24,21 @@ dest: "{{ emacsconf_caption_dir }}/scripts/reencode.sh" owner: "{{ emacsconf_user }}" group: "{{ emacsconf_group }}" - # This avoids overwriting zaeph's - force: no + backup: yes mode: 0775 - name: Copy scripts for processing - tags: process-prerec + tags: process-prerec, wip template: src: "{{ item }}" - dest: "{{ emacsconf_caption_dir }}/scripts/{{ item }}" + dest: "/usr/local/bin/{{ item }}" owner: "{{ emacsconf_user }}" group: "{{ emacsconf_group }}" mode: 0775 loop: - process-prerec.sh - - update-task-status.sh + - talk - upload.sh - publish-backstage-index.sh - update-emacsconf.sh - thumbnail.sh - + - reencode.sh diff --git a/roles/prerec/templates/process-prerec.sh b/roles/prerec/templates/process-prerec.sh index 8fdca72..4544b43 100755 --- a/roles/prerec/templates/process-prerec.sh +++ b/roles/prerec/templates/process-prerec.sh @@ -10,9 +10,9 @@ 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" +# /data/emacsconf/2022/scripts/talk $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 $MAIN && /data/emacsconf/2022/scripts/thumbnail.sh \"$MAIN\" && /data/emacsconf/2022/scripts/upload.sh $(echo "$MAIN" | sed s/webm$/png/) 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 -S $SCREEN -X screen -t captions-$SLUG /bin/bash -c "/data/emacsconf/2022/scripts/process-captions.py $(dirname $ORIGINAL); exec /bin/bash" screen -x $SCREEN diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh index 63be1d0..b0bdfc7 100755 --- a/roles/prerec/templates/reencode.sh +++ b/roles/prerec/templates/reencode.sh @@ -3,12 +3,12 @@ set -euo pipefail # Defaults -q=32 -cpu=4 +q={{ reencode_quality }} +cpu={{ reencode_cpu }} time_limit="" print_only=false -limit_resolution=1080 -limit_fps=30 +limit_resolution={{ res_y }} +limit_fps={{ fps }} while getopts :q:c:t:s OPT; do case $OPT in diff --git a/roles/prerec/templates/talk b/roles/prerec/templates/talk new file mode 100755 index 0000000..0531cda --- /dev/null +++ b/roles/prerec/templates/talk @@ -0,0 +1,21 @@ +#!/bin/bash +# {{ ansible_managed }} +# How to use: talk slug from-status-regexp to-status +# or talk slug to-status + +SLUG="$1" +FROM_STATUS="$2" +TO_STATUS="$3" +if [ "x$TO_STATUS" == "x" ]; then + FROM_STATUS=. + TO_STATUS="$2" +fi +cd {{ emacsconf_private_dir }} +#echo "Pulling conf.org..." +#git pull +echo "Updating status..." +emacsclient --eval "(emacsconf-with-todo-hooks (emacsconf-update-talk-status \"$SLUG\" \"$FROM_STATUS\" \"$TO_STATUS\"))" -a emacs +#echo "Committing and pushing in the background" +#git commit -m "Update task status for $SLUG from $FROM_STATUS to $TO_STATUS" conf.org +#git push & + diff --git a/roles/prerec/templates/update-task-status.sh b/roles/prerec/templates/update-task-status.sh deleted file mode 100755 index b3f59d2..0000000 --- a/roles/prerec/templates/update-task-status.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# {{ ansible_managed }} -# How to use: update-task-status.sh slug from-status-regexp to-status -# or update-task-status.sh slug to-status - -SLUG="$1" -FROM_STATUS="$2" -TO_STATUS="$3" -if [ "x$TO_STATUS" == "x" ]; then - FROM_STATUS=. - TO_STATUS="$2" -fi -cd {{ emacsconf_private_dir }} -echo "Pulling conf.org..." -git pull -echo "Updating status..." -emacsclient --eval "(emacsconf-with-todo-hooks (emacsconf-update-talk-status \"$SLUG\" \"$FROM_STATUS\" \"$TO_STATUS\"))" -a emacs -echo "Committing and pushing in the background" -git commit -m "Update task status for $SLUG from $FROM_STATUS to $TO_STATUS" conf.org -git push & - -- cgit v1.2.3