From 5c321d33dbf529006049e03ef8fa20ad95646940 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Tue, 10 Oct 2023 10:19:19 -0400 Subject: rename VIDEO_SLUG to FILE_PREFIX --- roles/prerec/templates/rename-original.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 roles/prerec/templates/rename-original.sh (limited to 'roles') diff --git a/roles/prerec/templates/rename-original.sh b/roles/prerec/templates/rename-original.sh new file mode 100755 index 0000000..110d39a --- /dev/null +++ b/roles/prerec/templates/rename-original.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# {{ ansible_managed }} +SLUG=$1 +FILE=$2 +TALKS_JSON=${3:-~/current/talks.json} +filename=$(basename -- "$FILE") +extension="${filename##*.}" +filename="${filename%.*}" +FILE_PREFIX=$(jq -r '.talks[] | select(.slug=="'$SLUG'")["file-prefix"]' < $TALKS_JSON) +mv "$FILE" $FILE_PREFIX--original.$extension +if [ -f $FILE_PREFIX--original.webm ] && [ ! -f $FILE_PREFIX--main.$extension ]; then + cp $FILE_PREFIX--original.$extension $FILE_PREFIX--main.webm +fi -- cgit v1.2.3