Hazel, EyeTV and metadata

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hazel, EyeTV and metadata Tue Jul 31, 2012 10:10 am • by ilium007
Hi - I am looking to use hazel to act on the recordings from EyeTV. I have it mostly figured out but I can't for the life of me find a way to add metadata via AppleScript to the resulting mp4 file either before or after it lands in iTunes. Any ideas ?
ilium007
 
Posts: 23
Joined: Sun May 01, 2011 5:42 pm

Re: Hazel, EyeTV and metadata Tue Jul 31, 2012 2:11 pm • by Mr_Noodle
Search the forums. I feel like someone else might have done this already.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Hazel, EyeTV and metadata Tue Jul 31, 2012 6:54 pm • by ilium007
I spent the night searching forums to no avail hence the post.
ilium007
 
Posts: 23
Joined: Sun May 01, 2011 5:42 pm

Re: Hazel, EyeTV and metadata Tue Jul 31, 2012 10:19 pm • by ilium007
I have found that Atomic Parsley will do what I need, not very elegant as I would rather just keep it all within the confines of Applescript and the iTunes dictionary rather than invoking a shell script.

See, I can do this - dead simple:

set theFile to "Users:brantwinter:Desktop:0000000015c80adc.iPad.m4v" as alias

Code: Select all
tell application "iTunes"
   launch
   try
      add theFile
   end try
end tell


But what if I want to change the 'video kind' to TV Show ?

I need to be able to run this:

Code: Select all
set video kind of ?????? to {TV show}


I dont know how to get a pointer to the newly added file in iTunes.

If I were to use Atomic Parsley I could do this before importing to iTunes, that way the metadata is already there.

Code: Select all
do shell script "./AtomicParsley " &  theFile & " --stik \"TV Show\" --TVShowName \"Family Guy\""

Any help / examples would be appreciated !
ilium007
 
Posts: 23
Joined: Sun May 01, 2011 5:42 pm

Re: Hazel, EyeTV and metadata Wed Aug 01, 2012 7:07 pm • by ilium007
I managed to get this all working last night. I will post code is anyone is interested.

But basically I have now got TV show recording from EyeTV to disk, automatic Handbrake encoding, Atomic Parsley metadata being added and then shipped into iTunes. :D :D
ilium007
 
Posts: 23
Joined: Sun May 01, 2011 5:42 pm

Re: Hazel, EyeTV and metadata Sun Oct 07, 2012 1:17 pm • by HackerJL
I would be interested. I am running everything through handbrakecli but would love to have it automate the tagging before shipping to itunes. Very interested.
HackerJL
 
Posts: 31
Joined: Thu Sep 22, 2011 6:28 pm

Re: Hazel, EyeTV and metadata Mon Oct 08, 2012 3:10 am • by ilium007
I will dig up the scripts for you tonight if I have time. Cheers.
ilium007
 
Posts: 23
Joined: Sun May 01, 2011 5:42 pm

Re: Hazel, EyeTV and metadata Tue Nov 13, 2012 6:36 pm • by cdavis
Here's what I have done:

I use a combination of iFlicks, Hazel, EyeTV and a couple of cobbled together applescripts to run it all.

I run EyeTv 3.5.6 and set up TV Shows to export to itunes at 720p automatically from Eyetv.

Hazel watches the itunes folder "TV Shows" and all subfolders. When a new file is added it processes the following script:

on hazelProcessFile(theFile)

tell application "iTunes"
activate
reveal playlist "New TV Shows"


delay 15.0

tell application "System Events" to tell process "iTunes"
keystroke "a" using {command down}

end tell

delay 15.0

tell application "System Events" to tell process "iTunes"
keystroke "u" using {command down, shift down}

end tell
end tell

end hazelProcessFile

That includes the Hazel wrappers.

As you can see in the script, I have a smart playlist in iTunes called new TV Shows. This smart playlist populates with shows added in the last 24 hours. I give iTunes a generous 15 second delay to add new shows to the smart playlist.

When iFlicks runs by invoking the cmd-shift-u itunes services menu keyboard shortcut, I have a few rules set up in iFlicks based on the name of TV Shows to tag them with AppleTV appropriate square album art and add the HD tag to files over 720 in height.

I also have a couple of scripts set up to run at given times through ical that clean up TV Shows with play counts of 1 or more (I don't save TV Shows) and clear out the recordings from EyeTV.
cdavis
 
Posts: 7
Joined: Tue Nov 13, 2012 6:29 pm

Re: Hazel, EyeTV and metadata Tue Jan 15, 2013 12:26 pm • by cdavis
I wanted to share some cleanup that i've done on this script:

on hazelProcessFile(theFile)

tell application "iTunes"
activate
reveal track 1 of playlist "New TV shows"
set sel to selection

delay 15.0

tell application "iTunes"
repeat with trk in selection
if video kind of trk is equal to movie or video kind of trk is equal to TV show then
set dbID to database ID of trk
tell application "iFlicks"
update track dbID without gui
end tell
end if
end repeat
end tell

delay 15.0

tell application "Finder"
set filename to name of (theFile)

tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Your TV Show is ready", content:"" & filename & " has been added to iTunes and is ready to view", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"myemailaddress@email.com"}
send


end tell
end tell
end tell
end tell


end hazelProcessFile

As you can see, this script is cleaned up quite a bit. It doesn't rely on key press scripting any longer, which speeds things up a bit.

It still depends on an iTunes playlist called "New TV shows" which filters shows that haven't been tagged with iFlicks yet. I do this by having iFlicks add a comment "iflicks" to every show tagged, then use the smart playlist "New TV shows" to filter by that comment.

The email portion of the script has been modified to email me *just* the file name and not the whole path...just a little more elegant and wife friendly.
cdavis
 
Posts: 7
Joined: Tue Nov 13, 2012 6:29 pm


Return to Open Discussion