EyeTV and AppleTV Integration

When the second generation AppleTV was released, I was intrigued by it, but even the low $99 price tag didn’t get me to bite as I couldn’t quite justify it. Now that we’re trying out Netflix (our viewing will increase this summer when most shows are in re-runs), the AppleTV became more interesting and then the enhanced AirPlay on the iPad pretty much sealed the deal for me getting one. I almost ordered one, but hesitated and then MacMall had an eBay special for $80 for one (+$6 California sales tax), so I bit.

So besides watching Netflix on it and streaming movies I create on my iPad with it, what else could I do with it? I already have a Mac Mini setup as a media center handling broadcast TV recordings on my EyeTV. Viewing shows with the EyeTV is fine, but I wanted to use the Remote app on the iPad as it looked cool (did I need a better reason?). I started hacking away at a system to export the videos and import them into iTunes on the fly. Since the export takes a long time, I needed to export the videos in the middle of the night after ETVComskip ran to strip out the commercials.

I came up with the following AppleScript to do the exports of the shows that were recorded in the last day.

set destFolder to "Macintosh HD:Users:mediacenter:Movies:EyeTV Encoded:"
set currentDate to (current date) - 1 * days
set currentSeconds to seconds of currentDate
tell application "EyeTV"
	set recordCount to count recordings
	if recordCount is greater than 0 then
		repeat with myCounter from 1 to count recordings
			set theRecording to item myCounter of recordings
			if busy of theRecording is false then
				set startDate to actual start of theRecording
				if (startDate > currentDate) then
					set thisTitle1 to title of theRecording
					set thisTitle2 to unique ID of theRecording
					set AppleScript's text item delimiters to ":"
					set theTextItems to text items of thisTitle1
					set AppleScript's text item delimiters to "-"
					set thisTitle1 to theTextItems as string
					set AppleScript's text item delimiters to {""}
					set thisTitle to thisTitle1 & " " & thisTitle2
					export from theRecording to file (destFolder & thisTitle & ".m4v") as AppleTV replacing no
				end if
			end if
		end repeat
	end if
end tell

Next I setup a cronjob like this:

15 0 * * *  /Library/Application\ Support/ETVComskip/\
MarkCommercials.app/Contents/MacOS/MarkCommercials\
 all > /dev/null 2>&1
15 2 * * * open /Users/mediacenter/Desktop/Export\
ToAppleTV.app
15 20 * * * rm -rf ~/Movies/EyeTV\ Encoded/*

The first line runs the commercial skipping, the second runs the AppleScript that I’ve saved as an app. The third line removes all the exported videos as they’re no longer needed.

I’ve been using this for about a week now and it’s working quite well. I can control the shows from my iPad, but my wife thinks I’m just doing it because I’m a geek (and I say, so?).

The only issues with this is that I can’t delete the shows with my AppleTV and as of now, I’m keeping the backup copies on the EyeTV. So I have to manually delete the watched shows from iTunes as well as EyeTV. Once I get more confident, I’ll modify the AppleScript to delete the shows from the EyeTV after exporting and then I can write another script that removes the shows from iTunes after they have been watched; this is a little risky as I’m not sure if I can tell if it has been completely watched or partly watched. I wouldn’t want to prematurely delete the shows.

While this isn’t for the novice, I think it’s pretty cool and if I can centralize all my media watching to the AppleTV, I’ll be pretty happy. The Remote app on the iPad is very slick and beats any standard remote.

14 Replies to “EyeTV and AppleTV Integration”

      1. Scott,
        Thanks! I will try it out. About EyeTVComskip. What else do I need besides the .dmg file to make it work on Mac? I contacted the developer of this package and I am still waiting for his response.

        Do you know if the EyeTVComskip modifies your apple triggered scripts or replace their content?

        1. Hi German,

          The EyeTVComSkip package I used is quite old and I haven’t touched it since I set it up awhile ago. I don’t use the triggered scripts as I have the tagging done daily as my Mac Mini doesn’t have the horsepower to record 2 shows, watch 1 as well as mark commercials on others at the same time. Unfortunately my whole setup required a lot of hand holding to get it right and occasionally it gets stuck and I have to kick it to get it working again.

  1. Hi Scott.

    Nice article. I’m reviewing my HTPC needs right now. I’ve currently got EyeTV but have to plug the mac into the TV to watch. I’d like a more elegant solution. Plex seems like a pain since it looks like it requires one to reorganize movies/videos into specific folders. I’m thinking about going the Apple way (iTunes sharing). I thought that EyeTV 3.x software allowed you to enable iPod/iPad sharing, which would create an H.264 version of the show for use in iTunes (after recording is complete). One strange observation: if you set “sharing” in preferences, it always creates the iTunes friendly version, and I believe it leaves it in the eyeTV media repository. But without sharing on, if you select some recordings then click on the ipod/ipad icon at the top, it will convert the videos then stick them in the iTunes library. I’m not happy with the requirement to convert videos just because sharing is on, and I’m not happy the behavior is different between “sharing” conversion and clicking on the ipad/ipod button to convert a video. Regardless, it appears you have a solution that works for you. Just wanted to let you know that I think EyeTV will do the conversion.

    And, cool to hear about the whole etvcomskip. I had never heard of it. Does it edit the video and remove the commercials? Does it only work on digital video sources? (I record both digital and analog.) Not much info out there on this.

    Thanks!
    Mark

    1. I’ve only used the commercial skipping on digital signals, but it should work fine on analog. I don’t use EyeTV’s sharing as I want the commercial skipping as well as I run all my transcoding in the morning when I’m not recording shows; less of an issue now that I’ve upgraded my Mac Mini, but was an issue before as my Mac Mini wasn’t powerful enough to record 2 shows and export all at the same time.

  2. Hi Scott,

    I have EyeTV and an ATV3 but found it a pain to have to transcode all my videos and import them into iTunes just to watch them. Not only that, but since the videos were over-the-air HDTV, my little mac mini didn’t have the horsepower to play the video smoothly with EyeTV. So for about the same price as an ATV, I bought a WDTV Live and it works great, though the interface isn’t as nice as the ATV. It plays my EyeTV recordings without any transcoding/exporting as well as any other video I throw at it, including mkv, avi, wmv, mp4, m4v, etc. Not only that, but after playing a video from my EyeTV, I can delete it with my remote.

    The main issue I had with EyeTV was when I set up scheduled recordings of say the NEWS and wanted to only keep say, one recording. Everything worked fine as long as I manually deleted the videos after viewing. The problem comes in when EyeTV automatically deletes the old videos. For some strange reason, EyeTV deletes the older video only, but not the folder that contained it. (Each video recorded with EyeTV is contained within its own folder) Why was this an issue? When you watch a video with the WDTV Live or any other player that can play the videos in their native format, you have to surf to each folder and then play the video contained within. But after EyeTV runs for a while deleting older videos automatically, your EyeTV default video folder fills up with old video folders that contain no videos. You have to look in each folder until you find the one that has your program. I emailed Elgato about this and they said that it sounds like a good feature to have in an upcoming release. Note that if you just use the EyeTV app to watch the videos, you never will encounter this issue.

    Anyway, the workaround I came up with was to write a short python script that periodically looks in each video folder and if there is no video contained within, it deletes the folder. Not elegant, but it works.

  3. Hello and thanks for this post. I use the Eyetv triggered script (RecordiingDone) to execute Etvcomskip. Every now and then ETVcomskip doesn’t mark the commercials. I want the software to rerun etvcomskip to mark the commercials so that I can remove them in the EyeTV software. I tried your terminal command and I changed “all” to the recordID of the specific show:

    /Library/Application\ Support/ETVComskip/\MarkCommercials.app/Contents/MacOS/MarkCommercials\
    all > /dev/null 2>&1

    The script MarkCommercials runs and runs and runs. I waited until the next day and it was still going. What am I doing wrong?

    Thanks

    1. Hi Jason,

      You may want to use the forceall instead of all and not worry about the recordID to see if that helps. Also, I have a launch daemon (setup using Lingon X) set to run my marking commercials in the middle of the night and not on recordingDone so that I don’t bog down the machine while it is recording another show.

      I don’t think there is a magic answer for your problem, unfortunately.

  4. Hello Scott

    Can you walk me through your process just before you moved to MythTV? It appears that you are did the following:

    -Recorded OTA broadcasts using your EyeTV software
    -Used a script to export the shows from your EyeTV Archive as opposed to exporting them using the EyeTV software
    -Used a script to mark commercials
    -Used a script to transcode using ffmpeg
    -Used a script to move the transcoded file to the Plex server

    Are these steps correct?

    1. Hi Jason,

      The steps are almost correct; I did the mark commercials before the export.

      1) Recorded using EyeTV
      2) Marked commercials using: “/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials” all (run at 12 am every day)
      3) Used the following AppleScript:

      tell application "Finder"
      with timeout of 86400 seconds
      set yesterdayDate to (current date) - 1 * days
      set eyeTVFolder to "Macintosh HD:Users:mediacenter:Documents:EyeTV Archive"
      set theFiles to (files of folder eyeTVFolder where name extension is "eyetv")
      repeat with theFile in theFiles
      set modDate to modification date of theFile
      if (modDate > yesterdayDate) then
      set posixFileLocation to quoted form of POSIX path of (theFile as alias)
      with timeout of 86400 seconds
      do shell script "/Users/mediacenter/Desktop/ConversionScripts/ProcessVideos -f /usr/local/bin/ffmpeg -p /Users/mediacenter/Plex -e " & posixFileLocation
      end timeout
      end if
      end repeat
      end timeout
      end tell

      ProcessVideos is my app from: https://github.com/sgruby/EyeTVExporter

      That AppleScript and process videos handles taking the EyeTV archives as well as the commercial markings and transcodes it using ffmpeg to place it into the right place for Plex.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.