From 78237afa2aeb93d40e1a01a92cf41cabafecc6be Mon Sep 17 00:00:00 2001 From: Oliver Atkinson Date: Sat, 30 Dec 2023 16:30:57 -0700 Subject: [PATCH] Fixed names for when files have spaces in them --- .local/bin/ssh-encode | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.local/bin/ssh-encode b/.local/bin/ssh-encode index f1b4a5d..6eeaa05 100755 --- a/.local/bin/ssh-encode +++ b/.local/bin/ssh-encode @@ -1,6 +1,5 @@ #!/bin/bash __usage="Usage: $(basename $0) FILE [ssh alias] - Options: [FILE], Input video file [ssh alias], The alias setup in ~/.ssh/config (default location) @@ -26,19 +25,19 @@ then fi FILE=$1 -BASE=$(basename $FILE) +BASE=$(basename "$FILE") OTHER=$2 EXTENSION=".new.mp4" -TEMP="/tmp/" +TEMP="/tmp/" # don't put in a dir with spaces # move file to other's temp drive -scp $FILE $OTHER:$TEMP +scp "$FILE" $OTHER:$TEMP # use ffmpeg to encode on other computer -ssh $OTHER "ffmpeg -y -i $TEMP$BASE -vcodec hevc $TEMP$BASE$EXTENSION" +ssh $OTHER "ffmpeg -y -i $TEMP\"$BASE\" -vcodec hevc -filter:v scale=-2:720 $TEMP\"$BASE\"$EXTENSION" # move file back -scp $OTHER:$TEMP$BASE$EXTENSION $FILE$EXTENSION +scp $OTHER:$TEMP"$BASE"$EXTENSION "$FILE"$EXTENSION # delete temp file -ssh $OTHER "rm $TEMP$FILE; rm $TEMP$FILE$EXTENSION" +ssh $OTHER "rm $TEMP\"$FILE\"; rm $TEMP\"$FILE\"$EXTENSION" if [[ $3 == "-d" ]]; rm $FILE