Error when running Workflow to tag file

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Error when running Workflow to tag file Sat Dec 31, 2011 1:56 pm • by CliffC
Hello. I am new to AppleScript and Hazel so please be gentle.

I wrote a workflow that downloads an XML file from thetvdb.com and then uses that information to rename and tag a file. It works fine when I run it myself, but there is a problem when I put it in one of the rules for Hazel. I get different errors every time the rule matches. Sometimes it even gives me an error and runs it anyways. Looking through my Hazel.log I see errors like the ones below:


2011-12-31 12:35:18.584 hazelfolderwatch[1242] Error executing Automator workflow /Users/Shared/Hazel/Workflows/American Horror Story - Rename and Tag.workflow: Error Domain=com.apple.Automator Code=-212 "The action “Run AppleScript” encountered an error." UserInfo=0x10033e5c0 {NSLocalizedDescription=The action “Run AppleScript” encountered an error., NSLocalizedRecoverySuggestion=Check the actionʼs properties and try running the workflow again., NSLocalizedFailureReason=Can’t make {alias "Macintosh HD:Users:Shared:Users:Temp:American.Horror.Story.S01E04.HDTV.XviD-ASAP.[VTV].mp4", alias "Macintosh HD:Users:Shared:Users:Temp:American.Horror.Story.S01E04.HDTV.XviD-ASAP.[VTV].mp4"} into type alias.}
2011-12-31 12:39:33.000 (null)[0] American.Horror.Story.S01E04.HDTV.XviD-ASAP.[VTV].mp4: Rule American Horror Story matched.
2011-12-31 12:39:41.886 hazelfolderwatch[1264] Error executing Automator workflow /Users/Shared/Hazel/Workflows/American Horror Story - Rename and Tag.workflow: (null)
2011-12-31 12:39:41.889 hazelfolderwatch[1264] [Error] Automator workflow failed: Error executing automator workflow /Users/Shared/Hazel/Workflows/American Horror Story - Rename and Tag.workflow on file /Users/Shared/Users/Temp/American.Horror.Story.S01E04.HDTV.XviD-ASAP.[VTV].mp4.

As I stated earlier the code seems to run correctly when I run it myself. Hazel won't run it if she matches it unless I select to "Run Rules Now", and then it seems 50/50 whether or not it will run. The workflow is (Get Selected Items, Run Applescript, Move file to Trash). This is what the code looks like:

__________________________________________________
on run {input, parameters}

set xml_file to (POSIX path of (path to temporary items)) & "file.xml"
do shell script "curl -L http://www.thetvdb.com/api/1D62F2F90030 ... all/en.xml" & " -o " & xml_file

-- previous line contains series specific feed

repeat with i in input
try
tell application "Finder" to set file type of file i to "MooV"
end try

tell application "Finder"
set this_file to input as alias
--set TheName to name of (this_file as alias)
set posix_this_file to POSIX path of (this_file as alias)
--set parentFolderPath to text 1 thru ((offset of TheName in posix_this_file) - 2) of posix_this_file

-- pull series name out of the xml file
set seriesNameGrepResult to do shell script ("grep SeriesName " & xml_file)
set AppleScript's text item delimiters to "<SeriesName>"
set tempSeriesName to text item 2 of seriesNameGrepResult
set AppleScript's text item delimiters to "</SeriesName>"
set seriesBaseName to text item 1 of tempSeriesName

--deal with season and episode information
set AppleScript's text item delimiters to "."
set episodeString to (text item 4 of posix_this_file)
-- previous line contains series specific search
set AppleScript's text item delimiters to "E"
set episodeNum to text item -1 of episodeString
set tempSeason to text item 1 of episodeString
set AppleScript's text item delimiters to "S"
set seasonNum to text item -1 of tempSeason
--set AppleScript's text item delimiters to "."
--set fileExt to (text item -1 of posix_this_file)

--code for search strings through XML
set strippedENum to do shell script ("expr " & episodeNum & " + 0")
set strippedSNum to do shell script ("expr " & seasonNum & " + 0")

set episodeNameGrepResult to do shell script ("grep -C 10 \"<EpisodeNumber>" & strippedENum & "\" " & xml_file & " | grep -B 19 \"<SeasonNumber>" & strippedSNum & "\" | grep EpisodeName | sed \"s/\\'/\"\"/g\" ")

set AppleScript's text item delimiters to "<EpisodeName>"
set tempepisodeNameGrepResult to text item 2 of episodeNameGrepResult
set AppleScript's text item delimiters to "</EpisodeName>"
set episodeName to text item 1 of tempepisodeNameGrepResult

-- set name of this_file to seriesBaseName & " - " & episodeString & "." & fileExt
-- Rename the file

-- Set Tags for file
set genreGrepResult to do shell script ("grep Genre " & xml_file)
set AppleScript's text item delimiters to "|"
set genreResult to text item 2 of genreGrepResult

set epidGrepResult to do shell script ("grep -C 10 \"<EpisodeNumber>" & strippedENum & "\" " & xml_file & " | grep -B 19 \"<SeasonNumber>" & strippedSNum & "\" | grep id ")
set AppleScript's text item delimiters to "<id>"
set tempepidGrepResult to text item 2 of epidGrepResult
set AppleScript's text item delimiters to "</id>"
set epidResult to text item 1 of tempepidGrepResult

set episodeFullNameGrepResult to do shell script ("grep -C 10 \"<EpisodeNumber>" & strippedENum & "\" " & xml_file & " | grep -B 19 \"<SeasonNumber>" & strippedSNum & "\" | grep EpisodeName ")
set AppleScript's text item delimiters to "<EpisodeName>"
set tempepisodeFullNameGrepResult to text item 2 of episodeFullNameGrepResult
set AppleScript's text item delimiters to "</EpisodeName>"
set episodeFullNameResult to text item 1 of tempepisodeFullNameGrepResult

set overviewGrepResult to do shell script ("grep -C 10 \"<EpisodeNumber>" & strippedENum & "\" " & xml_file & " | grep -B 19 \"<SeasonNumber>" & strippedSNum & "\" | grep Overview ")
set AppleScript's text item delimiters to "<Overview>"
set tempOverviewGrepResult to text item 2 of overviewGrepResult
set AppleScript's text item delimiters to "</Overview>"
set overviewResult to text item 1 of tempOverviewGrepResult

set actorsGrepResult to do shell script ("grep Actors " & xml_file)
set AppleScript's text item delimiters to "<Actors>"
set tempactorsGrepResult to text item 2 of actorsGrepResult
set AppleScript's text item delimiters to "</Actors>"
set tempActorsResult_1 to text item 1 of tempactorsGrepResult
set tempActorsResult_2 to do shell script ("echo \"" & tempActorsResult_1 & "\" | sed -e \"s/.//\"")
set tempActorsResult_3 to do shell script ("echo \"" & tempActorsResult_2 & "\" | sed -e \"s/\\(.*\\)./\\1/\"")
set actorsResult to do shell script ("echo \"" & tempActorsResult_3 & "\" | sed \"s/\\|/\",\"/g\"")

set yearGrepResult to do shell script ("grep -C 10 \"<EpisodeNumber>" & strippedENum & "\" " & xml_file & " | grep -B 19 \"<SeasonNumber>" & strippedSNum & "\" | grep FirstAired ")
set AppleScript's text item delimiters to "<FirstAired>"
set tempyearGrepResult to text item 2 of yearGrepResult
set AppleScript's text item delimiters to "</FirstAired>"
set tempyearResult to text item 1 of tempyearGrepResult
set AppleScript's text item delimiters to "-"
set yearResult to text item 1 of tempyearResult

--set posterGrepResult to do shell script ("grep Poster")
--set AppleScript's text item delimiters to "<Poster>"
--set posterGrepResult to text item 2 of posterGrepResult
--set AppleScript's text item delimiters to "</Poster>"
--set tempPosterResult to text item 1 of tempposterGrepResult
--set posterResult to "http://www.theTVDB.com/banners/" & tempPosterResult
--display dialog posterResult

tell application "iTunes"
set newAddition to (add (i as alias))

--sets tv show tags and imports into iTunes

tell newAddition to set video kind to TV show
tell newAddition to set show to seriesBaseName
tell newAddition to set season number to strippedSNum
tell newAddition to set episode number to strippedENum
tell newAddition to set episode ID to epidResult
tell newAddition to set genre to genreResult
tell newAddition to set name to episodeFullNameResult
tell newAddition to set description to overviewResult
tell newAddition to set artist to actorsResult
tell newAddition to set year to yearResult
tell newAddition to set track number to strippedENum
--tell newAddition to set artwork to posterResult
end tell

end tell
end repeat
return input
end run
__________________________________________________

Parts of the file were commented out because I decided to let iTunes rename the file based on the tags when it imports it.

Any help anyone can offer would be greatly appreciated. Please let me know if you need more information or clarification. Thank you in advance.
CliffC
 
Posts: 4
Joined: Sat Dec 31, 2011 11:31 am

Re: Error when running Workflow to tag file Mon Jan 02, 2012 3:08 pm • by Mr_Noodle
Is this an AppleScript being run from Automator? If so, why not just have Hazel run the AppleScript directly? Check the help as there is a template there (you need to use a specific handler) but otherwise, I'm not sure why Automator is needed.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Error when running Workflow to tag file Wed Jan 04, 2012 9:09 am • by CliffC
Sorry it was part of workflow that had AppleScript in it. I decided to write a shell script since I am more familiar with it.

This is what I ended up with.

_____________________________________

#!/bin/bash
# Movie tag and import

MAIN_DIR="${PWD}"
FILES="${PWD}/*"
IFS="
"
tagFile="/tmp/tagfile.tmp"
XMLFile="/tmp/tagfile.xml"
AutoAddItunesDir="/Users/Shared/Media/Automatically Add to iTunes/"

# move all movies files to base directory and move the directory to the trash
for f in $FILES
do

#check to see if $f is a directory
if [ -d "$f" ]
then
cd $f

for i in *
do
if [ -d "$i" ]
then
echo "$i is a directory"
else
EXT="${i##*.}"

if [ "$EXT" == 'mp4' ] || [ "$EXT" == 'm4v' ] || [ "$EXT" == 'avi' ] || [ "$EXT" == 'mpg' ] || [ "$EXT" == 'mpeg' ] || [ "$EXT" == 'mkv' ] || [ "$EXT" == 'mov' ]
then
mv ${i} ..
else
continue
fi
fi
done

cd $MAIN_DIR

#remove the directory after processing and changing back to parent directory
mv -f $f ~/.Trash
else
continue
fi

done

# convert any available non-mp4 and non-m4v files
for f in $FILES
do
EXT="${f##*.}"
#check to see if $f is a candidate for conversion
if [ "$EXT" == 'avi' ] || [ "$EXT" == 'mpg' ] || [ "$EXT" == 'mpeg' ] || [ "$EXT" == 'mkv' ] || [ "$EXT" == 'mov' ]
then
#check to see if file exists in mp4 or m4v format
baseFileName=`basename $f $EXT`
baseFileNameMP4="${baseFileName}mp4"
baseFileNameM4V="${baseFileName}m4v"
if [ ! -f "./${baseFileNameMP4}" ] && [ ! -f "./${baseFileNameM4V}" ]
then
HandBrakeCLI -i ${f} -o $baseFileNameM4V --preset \"AppleTV\ 2\"
echo "CONVERSION: Converted ${f} to $baseFileNameM4V" >> tni.log
mv -f $f ~/.Trash
else
continue
fi
else
continue
fi

done

#tag Files
for f in $FILES
do
EXT="${f##*.}"

#check to see if $f is a taggable file
if [ "$EXT" == 'mp4' ] || [ "$EXT" == 'm4v' ]
then
#strip the name of the show from the file
#name is expected to be in this.shows.name.s01e01.whatever format - e.g. american.horror.story.s01e01.xvid-lol.m4v
baseFileName=`basename $f $EXT`
fileName=`echo $baseFileName | sed 's/\([^.]*\)[sS]..[eE]..*/\1/' | sed 's/\./ /g' | sed 's/\(.*\)./\1/'`

#use the stripped name to search thetvdb site for the showID then clean up
searchFileName=`echo ${fileName} | sed 's/ /+/g'`
searchString="http://thetvdb.com/?string=${searchFileName}&searchseriesid=&tab=listseries&function=Search"
/usr/bin/curl -L "${searchString}" -o ${tagFile}
showID=`grep "English" ${tagFile} | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'`
echo ${showID}
#check to see if the we were able to get a show ID so we can tag the file. If not fail...
if [ "${showID}" == "" ]
then
echo "ERROR: Failed to get show ID for $f. Unable to process the file." >> tni.log
else


#use the showID to download the shows XML file
fetchXMLString="http://www.thetvdb.com/api/1D62F2F90030C444/series/${showID}/all/en.xml"
echo
/usr/bin/curl -L "${fetchXMLString}" -o "${XMLFile}"

#use XML file to extract information to tag file
seriesName=`grep SeriesName ${XMLFile} | sed 's/<SeriesName>\(.*\)<\/SeriesName>/\1/' | sed 's/^[[:space:]]*//'`
seasonNum=`echo ${baseFileName} | sed 's/.*\([sS]..[eE]..\).*/\1/' | sed 's/[sS]\(..\)[eE]../\1/'`
seasonNum=`expr ${seasonNum} + 0` #removes and preceding 0's
episodeNum=`echo ${baseFileName} | sed 's/.*\([sS]..[eE]..\).*/\1/' | sed 's/[sS]..[eE]\(..\)/\1/'`
episodeNum=`expr ${episodeNum} + 0` #removes and preceding 0's
episodeName=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "EpisodeName" | sed 's/<EpisodeName>\(.*\)<\/EpisodeName>/\1/' | sed 's/^[[:space:]]*//'`
genreName=`grep "Genre" ${XMLFile} | sed 's/<Genre>|\(.*\)|<\/Genre>/\1/' | sed 's/^[[:space:]]*//'`
episodeID=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "<id>" | sed 's/<id>\(.*\)<\/id>/\1/' | sed 's/^[[:space:]]*//'`
epDesc=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "Overview" | tr -d '[\n]' | sed 's/<Overview>\(.*\)<\/Overview>/\1/' | sed 's/\&quot\;/\"/g' | sed 's/^[[:space:]]*//'`
seriesActors=`grep "Actors" ${XMLFile} | sed 's/<Actors>\(.*\)<\/Actors>/\1/' | sed 's/\|/,/g' | sed 's/^[[:space:]]*//' | sed 's/,\(.*\),/\1/'`
seriesYear=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "FirstAired" | sed 's/<FirstAired>\(.*\)<\/FirstAired>/\1/' | sed 's/^[[:space:]]*//' | sed 's/\(....\).*/\1/'`
seriesPosterName=`grep "poster" ${XMLFile} | sed 's/<poster>\(.*\)<\/poster>/\1/' | sed 's/^[[:space:]]*//'`
seriesPosterLink="http://thetvdb.com/banners/${seriesPosterName}"
imageFile=`echo ${seriesPosterName} | sed 's/posters\/\(.*\)/\1/'`

#download series poster
if [ ! -f "./${imageFile}" ]
then
/opt/local/bin/wget ${seriesPosterLink}
fi

#tag file
/usr/bin/AtomicParsley $f --overWrite --title "${episodeName}" --artist "${seriesActors}" --year "${seriesYear}" --genre "${genreName}" --tracknum "${episodeNum}" --stik "TV Show" --TVShowName "${seriesName}" --TVEpisode "${episodeID}" --TVSeasonNum "${seasonNum}" --TVEpisodeNum "${episodeNum}" --description "${epDesc}" --artwork "./${imageFile}" --copyright "" --encodingTool ""
rm *.jpg

fi
else
continue
fi
done

#tag Files
for f in $FILES
do
EXT="${f##*.}"

#check to see if $f is a taggable file
if [ "$EXT" == 'mp4' ] || [ "$EXT" == 'm4v' ]
then
mv $f ${AutoAddItunesDir}
echo "done"
else
continue
fi
done

rm ${tagFile}
rm ${XMLFile}

________________________________

Seems to work fine. Transmission drops it in the TV Shows folder under downloads. Hazel uses the rule given to run the script. The script checks to see if it is a directory, moves those files to the base directory, deletes the folder, converts the files to m4v format if they aren't already m4v or mp4 using HandBrakeCLI, then uses AtomicParsley to tag them, and finally moves them to the folder so iTunes can automatically add them and removes the leftover files. I tried making this without all the for loops, but it kept running straight through the files without stopping to convert, which made tagging them impossible. Seems to work for me. Hazel is running it like a champ. Thank you for the help.
CliffC
 
Posts: 4
Joined: Sat Dec 31, 2011 11:31 am

Re: Error when running Workflow to tag file Wed Jan 04, 2012 1:23 pm • by Mr_Noodle
I don't see in your script anywhere where it references the file that Hazel passes in. You can't use PWD here. Do not assume any file locations and use the path passed in.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Error when running Workflow to tag file Wed Jan 04, 2012 4:48 pm • by CliffC
Right now I am not using any file passed from Hazel. I wrote the script for Hazel to execute when "any file" was put in the directory "TV Shows". I was testing it all on command line and just figured it was easier to leave it as is since it was working.

I'm sorry, but I don't understand the issue with using PWD. If Hazel calls it in the TV Shows directory it should use that as the PWD. I'm not sure why this would be wrong.
CliffC
 
Posts: 4
Joined: Sat Dec 31, 2011 11:31 am

Re: Error when running Workflow to tag file Wed Jan 04, 2012 5:38 pm • by sjk
Hi CliffC. Just wanted to mention that putting scripts, etc. inside BBCode [code]…[/code] tags makes them more reader-friendly here. :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Error when running Workflow to tag file Wed Jan 04, 2012 6:40 pm • by CliffC
Sorry sjk. I don't use forums much but will try to use the tags from now on.

Mr_Noodle,

Since looking at your last post I realized how much easier it would have been to just use a few different rules to match and break my scripts down into sections that way.

I also realized that my script has the potential to mishandle files if one is dropped in if Transmission moves them in the folder at the while it is executing. So I changed it a little and it seems to be working great.

I made my first rule to Apply Rules to Folders and then made the conditions "Kind is Folder" and had it "Run rules on folder contents" and then "Move file to folder Trash". That way after it processed the files and imported them it would delete the folder.

Next I made a rule to check for any valid extensions that could be converted (e.g. avi, mpg, etc) and then have it run the embedded shell script:
Code: Select all
IFS="
"

for f in $1
do
   EXT="${f##*.}"
    #check to see if $f is a candidate for conversion
      #check to see if file exists in mp4 or m4v format
      baseFileName=`basename $f $EXT`
      baseFileNameMP4="${baseFileName}mp4"
      baseFileNameM4V="${baseFileName}m4v"
      if [ ! -f "./${baseFileNameMP4}" ] && [ ! -f "./${baseFileNameM4V}" ]
         then
         HandBrakeCLI -i ${f} -o $baseFileNameM4V --preset \"AppleTV\ 2\"
         echo "CONVERSION: Converted ${f} to $baseFileNameM4V" >> tni.log
         mv -f $f ~/.Trash
      else
         continue
      fi

done


Then I made two different rules. The first matched extension mp4 and names that don't contain the word temp (AtomicParsley by default renames the file and adds temp in it, and this will let me move to the next rule) then runs the embedded shell script below. The second is just a duplicate of the same rule but with extension m4v.

Code: Select all
IFS="
"
tagFile="/tmp/tagfile.tmp"
XMLFile="/tmp/tagfile.xml"

for f in $1
do
   EXT="${f##*.}"

    #check to see if $f is a taggable file
         #strip the name of the show from the file
            #name is expected to be in this.shows.name.s01e01.whatever format - e.g. american.horror.story.s01e01.xvid-lol.m4v
         baseFileName=`basename $f $EXT`
         fileName=`echo $baseFileName | sed 's/\([^.]*\)[sS]..[eE]..*/\1/' | sed 's/\./ /g' | sed 's/\(.*\)./\1/'`
         
         #use the stripped name to search thetvdb site for the showID then clean up
         searchFileName=`echo ${fileName} | sed 's/ /+/g'`
         searchString="http://thetvdb.com/?string=${searchFileName}&searchseriesid=&tab=listseries&function=Search"
         /usr/bin/curl -L "${searchString}" -o ${tagFile}
         showID=`grep "English" ${tagFile} | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'`
         echo ${showID}
         #check to see if the we were able to get a show ID so we can tag the file. If not fail...
         if [ "${showID}" == "" ]
            then
            echo "ERROR: Failed to get show ID for $f. Unable to process the file." >> tni.log
         else


            #use the showID to download the shows XML file
            fetchXMLString="http://www.thetvdb.com/api/1D62F2F90030C444/series/${showID}/all/en.xml"
            echo
            /usr/bin/curl -L "${fetchXMLString}" -o "${XMLFile}"

            #use XML file to extract information to tag file
            seriesName=`grep SeriesName ${XMLFile} | sed 's/<SeriesName>\(.*\)<\/SeriesName>/\1/' | sed 's/^[[:space:]]*//'`
            seasonNum=`echo ${baseFileName} | sed 's/.*\([sS]..[eE]..\).*/\1/' | sed 's/[sS]\(..\)[eE]../\1/'`
            seasonNum=`expr ${seasonNum} + 0` #removes and preceding 0's
            episodeNum=`echo ${baseFileName} | sed 's/.*\([sS]..[eE]..\).*/\1/' | sed 's/[sS]..[eE]\(..\)/\1/'`
            episodeNum=`expr ${episodeNum} + 0` #removes and preceding 0's
            episodeName=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "EpisodeName" | sed 's/<EpisodeName>\(.*\)<\/EpisodeName>/\1/' | sed 's/^[[:space:]]*//'`
            genreName=`grep "Genre" ${XMLFile} | sed 's/<Genre>|\(.*\)|<\/Genre>/\1/' | sed 's/^[[:space:]]*//'`
            episodeID=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "<id>" | sed 's/<id>\(.*\)<\/id>/\1/' | sed 's/^[[:space:]]*//'`
            epDesc=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "Overview" | tr -d '[\n]' | sed 's/<Overview>\(.*\)<\/Overview>/\1/' | sed 's/\&quot\;/\"/g' | sed 's/^[[:space:]]*//'`
            seriesActors=`grep "Actors" ${XMLFile} | sed 's/<Actors>\(.*\)<\/Actors>/\1/' | sed 's/\|/,/g' | sed 's/^[[:space:]]*//' | sed 's/,\(.*\),/\1/'`
            seriesYear=`grep -C 12 "<EpisodeNumber>${episodeNum}" ${XMLFile} | grep -B 25 "<SeasonNumber>${seasonNum}" | grep "FirstAired" | sed 's/<FirstAired>\(.*\)<\/FirstAired>/\1/' | sed 's/^[[:space:]]*//' | sed 's/\(....\).*/\1/'`
            seriesPosterName=`grep "poster" ${XMLFile} | sed 's/<poster>\(.*\)<\/poster>/\1/' | sed 's/^[[:space:]]*//'`
            seriesPosterLink="http://thetvdb.com/banners/${seriesPosterName}"
            imageFile=`echo ${seriesPosterName} | sed 's/posters\/\(.*\)/\1/'`

            #download series poster
            if [ ! -f "./${imageFile}" ]
               then
                  /opt/local/bin/wget ${seriesPosterLink}
            fi

            #tag file
            /usr/bin/AtomicParsley $f --title "${episodeName}" --artist "${seriesActors}" --year "${seriesYear}" --genre "${genreName}" --tracknum "${episodeNum}" --stik "TV Show" --TVShowName "${seriesName}" --TVEpisode "${episodeID}" --TVSeasonNum "${seasonNum}" --TVEpisodeNum "${episodeNum}" --description "${epDesc}" --artwork "./${imageFile}" --copyright "" --encodingTool ""
            rm *.jpg
            mv ${f} ~/.Trash

         fi
done


Then the last step was to add two more rules. One checked for extension mp4 and the name containing temp and then second was a duplicate with the extension m4v substituted. The rules import them into the iTunes library and then move the file to trash.

I can see now how using more of Hazel's features would have saved me a lot of time and a lot less wear and tear on the keyboard :D

This was the last piece in the puzzle for me to fully automate my TV watching process.

Thank you again for all the help. Going to buy Hazel now since the trial worked out and try to work on a movie tagger next.
CliffC
 
Posts: 4
Joined: Sat Dec 31, 2011 11:31 am

Re: Error when running Workflow to tag file Fri Jan 06, 2012 3:10 pm • by sjk
CliffC wrote:Sorry sjk. I don't use forums much but will try to use the tags from now on.

Thanks; your latest scripts are much more readable with those tags. No need to apologize. :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene


Return to Support