summaryrefslogtreecommitdiffstats
path: root/roles/prerec/templates/rename-original.sh
diff options
context:
space:
mode:
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