A script for SABnzbd+ to move new videos to an Apple TV

No Comments

This is a script for transcoding MKV files and moving files downloaded from SABnzbd+ to an Apple TV. It uses Handbrake CLI to transcode files. Save this as a shell script (converit.sh, for exampe) and place it in your SABnzbd+'s scripts folder.

### Transcode existing mkv files and move all files

# Get the beginning time from the date cmd.
START=$(date +%D\ %T)

echo "Entering directory $1"
cd "$1"
pwd
echo "Start at $START"

echo "Removing Samples..."
rm *sample*
echo "Checking for MKV"
for i in `ls *.mkv`
do
echo "Converting $i ..."

/Applications/HandBrakeCLI --input "$i" --output "$i.mp4"
echo "Removing MKV file…"
rm "$i"
done
pwd

echo "Copying files…"
scp -r "$1" frontrow@appletv.local:~/Movies/TV/

#scp "*.avi" frontrow@appletv.local:~/Movies/TV/
#echo "Copying MP4 files..."
#scp "*.mp4" frontrow@appletv.local:~/Movies/TV/

# Get the ending time of the transcode process from the date cmd.
END=$(date +%D\ %T)
echo "Done at $END"

Be the first to write a comment!