A long story cut short im trying to never again touch my Eye TV, i schedule recordings in IceTV they record and ive got it to encode them as h.264 so i end up with a .m4v file.
So basically i need to call a script every say 15 minutes to query /Volumes/EyeTV/TV/EyeTV Archive//.m4v
Im checking to see if the file is older then 2 minutes ago this way i can know for sure that the m4v file isnt being encoded still.
Then grab the .m4v file and import it into Itunes under a playlist of EyeTV (not that this playlist function is really needed as it places the files in “TV Shows”
Final process is delete the .m4v file so we dont get double in itunes.
Though this runs i cant seem to workout why it doesnt work
mactv:EyeTV Archive reece$ /usr/bin/osascript movie.scpt
mactv:EyeTV Archive reece$
It just doesnt seem to do anything
if i just throw the m4v file into itunes it goes into TV Shows i just dont want to have to do this manual all the time.
This is what ive written so far maybe i have a bug in it.
Any help greatly appreciated.
tell application "Finder"
set moviesFolder to folder "EyeTV:TV:EyeTV Archive"
set movieCount to the count of files in moviesFolder
set movieCountNew to 0
if movieCount > movieCountNew then
set minutesAgo to ((current date) - (2 * minutes))
set movieFiles to the name of every file of moviesFolder
set moviesFolder to moviesFolder as string
repeat with i from 1 to movieCount
set movieFile to item i of movieFiles
if the movieFile contains ".m4v" then
set moviePath to {moviesFolder & movieFile} as string
set modDate to the modification date of item moviePath
if modDate < minutesAgo then
tell application "iTunes"
set userPlaylist to user playlist "EyeTV"
add alias moviePath to userPlaylist
set movieTracks to (tracks of userPlaylist)
repeat with movieTrack in movieTracks
set movieTrackName to name of movieTrack as string
if movieFile contains movieTrackName then
set video kind of movieTrack to TV show
set AppleScript's text item delimiters to " - "
set tokens to (every text item of movieTrackName) as list
set show of movieTrack to item 1 of tokens
if the (count of items in tokens) > 1 then
set name of movieTrack to item 2 of tokens
else
set name of movieTrack to the (current date) as string
end if
set comment of movieTrack to "original track name: " & movieTrackName
end if
end repeat
end tell
tell application "Finder"
delete item moviePath
end tell
end if
end if
end repeat
end if
end tell