Last active
January 7, 2023 23:58
-
-
Save tlockney/56b8ce42b026360db281b22422a7c33a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
shopt -s inherit_errexit | |
# Make sure HandBrakeCLI is in the path -- I've got it installed in ~/bin for now | |
# since it disappeared from Homebrew | |
PATH=$HOME/bin:$PATH | |
MOVIES=$HOME/Movies | |
NAS_DIR=/Volumes/Media/Movies | |
IN=$(readlink -f "$1") | |
BASEFILENAME=$(basename "$IN") | |
TO_PROCESS="$MOVIES/PROCESSING/$BASEFILENAME" | |
TARGETFILE=${BASEFILENAME%.mkv}.mp4 | |
OUT="$MOVIES/OUT/$TARGETFILE" | |
echo "Processing \"$BASEFILENAME\" to \"$TARGETFILE\"" | |
mv "$IN" "$TO_PROCESS" | |
HandBrakeCLI -Z "HQ 1080p30 Surround" -i "$TO_PROCESS" -o "$OUT" | |
rm "$TO_PROCESS" | |
test -d "$NAS_DIR" && rsync -avPS "$OUT" "$NAS_DIR" | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment