my handbrakecli "run on torrent finished" example
Posted: Wed Nov 27, 2024 8:40 pm
sharing what I came up with to automatically run handbrakecli to encode downloads to my preferred 480p storage size:
1. download handbrakecli (https://handbrake.fr/downloads2.php)
2. qb, value in "run on torrent finished" field: /usr/bin/bash /home/username/Documents/HBCLI_aftercomplete.sh "%N" "%F" "%R" "%D"
3. content of HBCLI_aftercomplete.sh:
#!/bin/bash
set -m
strTorrentName=$1
strContentPath=$2
strRootPath=$3
strSavePath=$4
strOutputDir="/home/username/Documents"
# Loop through files in the target directory
for objFile in `find $strContentPath -type f -name "*.avi" -o -name "*.mp4" -o -name "*.mkv" -print0 | xargs -0 basename -a`;
do
/usr/bin/HandBrakeCLI -Z "Very Fast 480p30" -i "$strContentPath/$objFile" -o "$strOutputDir/$objFile"
done
done
1. download handbrakecli (https://handbrake.fr/downloads2.php)
2. qb, value in "run on torrent finished" field: /usr/bin/bash /home/username/Documents/HBCLI_aftercomplete.sh "%N" "%F" "%R" "%D"
3. content of HBCLI_aftercomplete.sh:
#!/bin/bash
set -m
strTorrentName=$1
strContentPath=$2
strRootPath=$3
strSavePath=$4
strOutputDir="/home/username/Documents"
# Loop through files in the target directory
for objFile in `find $strContentPath -type f -name "*.avi" -o -name "*.mp4" -o -name "*.mkv" -print0 | xargs -0 basename -a`;
do
/usr/bin/HandBrakeCLI -Z "Very Fast 480p30" -i "$strContentPath/$objFile" -o "$strOutputDir/$objFile"
done
done