summaryrefslogtreecommitdiffstats
path: root/roles/prerec/templates/rename-original.sh
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2024-10-01 19:59:03 -0400
committerSacha Chua <sacha@sachachua.com>2024-10-01 19:59:03 -0400
commit2be81b299be9cad0b03495f2ea038a01969c6cb2 (patch)
tree6f798cdf8233d0c1079eaff3a52fd3bdabf8bdf7 /roles/prerec/templates/rename-original.sh
parenta50799ae2d27ea57f9f470a9ecfb06dd77499c34 (diff)
downloademacsconf-ansible-2be81b299be9cad0b03495f2ea038a01969c6cb2.tar.xz
emacsconf-ansible-2be81b299be9cad0b03495f2ea038a01969c6cb2.zip
Update for new ansible version
Diffstat (limited to '')
-rwxr-xr-xroles/prerec/templates/rename-original.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/roles/prerec/templates/rename-original.sh b/roles/prerec/templates/rename-original.sh
index 0499ae8..ed085ed 100755
--- a/roles/prerec/templates/rename-original.sh
+++ b/roles/prerec/templates/rename-original.sh
@@ -8,7 +8,7 @@ EXTRA=""
if [ -z ${3-unset} ]; then
EXTRA=""
elif [ -n "$3" ]; then
- EXTRA="--$3"
+ EXTRA="$3"
elif echo "$FILE" | grep -e '\(webm\|mp4\|mov\)'; then
EXTRA="--original"
fi
@@ -16,8 +16,13 @@ filename=$(basename -- "$FILE")
extension="${filename##*.}"
filename="${filename%.*}"
FILE_PREFIX=$(jq -r '.talks[] | select(.slug=="'$SLUG'")["file-prefix"]' < $TALKS_JSON)
-mv "$FILE" $FILE_PREFIX$EXTRA.$extension
-echo $FILE_PREFIX$EXTRA.$extension
+if echo "$FILE" | grep -q \\. ; then
+ mv "$FILE" $FILE_PREFIX$EXTRA.$extension
+ echo $FILE_PREFIX$EXTRA.$extension
+else
+ mv "$FILE" $FILE_PREFIX$EXTRA
+ echo $FILE_PREFIX$EXTRA
+fi
# Copy to original if needed
if [ -f $FILE_PREFIX--original.webm ] && [ ! -f $FILE_PREFIX--main.$extension ]; then
cp $FILE_PREFIX--original.$extension $FILE_PREFIX--main.webm