ISO?

Come up with a useful post-processing script? Share it here!
Post Reply
randyharris
Full Member
Full Member
Posts: 146
Joined: January 21st, 2010, 5:36 pm

ISO?

Post by randyharris »

This is a post processing script I am using for Movies, it works fine on MKVs but even though I have added other file types, it won't for example encode an *.ISO file. Any ideas how to update this so that it will do the other file types not just AVI and MKV? I'm not sure why it isn't working.

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
Post Reply