Thanks.
Code: Select all
#!/bin/bash
# 1 The final directory of the job (full path)
# 2 The name of the NZB file
# 3 Clean version of the job name (no path info and ".nzb" removed)
# 4 Newzbin report number (may be empty
# 5 Newzbin or user-defined category
# 6 Group that the NZB was posted in e.g. alt.binaries.x
DIR=$1
NZB_FILE=$2
NAME=$3
NZB_ID=$4
CATEGORY=$5
GROUP=$6
echo "Directory: "$DIR
echo "NZB Filename: "$NZB_FILE
echo "Job Name: "$NAME
echo "NZB ID: "$NZB_ID
echo "Category: "$CATEGORY
echo "Usenet Group: "$GROUP
echo ""
echo ""
# wont print error in for loop if there are no avi/mkv files in the directory
shopt -s nullglob
# navigate to directory of video file
cd "$DIR"
# iterate through all avi/mkv/iso/img/mp4 files
for i in *.avi *.mkv *.iso *.img *.mp4; do
# if there is already an .m4v file continue
if [[ -e "${i%.*}"".m4v" ]]; then
echo "Skipping" $i
continue
fi
# convert avi/mkv/iso/img/mp4 file to m4v file using HandBrake
/Applications/HandBrakeCLI -i "$i" -o "${i%.*}"" - AppleTV_processing.m4v" --preset="AppleTV"
# if HandBrake did not exit gracefully, continue with next iteration
if [[ $? -ne 0 ]]; then
continue
fi
mv "${i%.*}"" - AppleTV_processing.m4v" "/Users/randyharris/Movies/""${i%.*}"".m4v"
# use iDentify to Tag and import into iTunes
open -a /Users/randyharris/Applications/iDentify.app "/Users/randyharris/Movies/""${i%.*}"".m4v"
# Open the ~/Movies folder so that you can update the Movie name and pass it to iDentify
## open -a finder ~/Movies
## The new iDentify now allows for movies to be queued up and you can view the tags before committing them.
done
exit 0