EyeTV, HDHomerun Dual, and Recording OTA - Exporting, AppleScripts, etc.

Discussion in 'Apple TV and Home Theater' started by cpeek, Apr 10, 2013.

  1. cpeek macrumors newbie

    Apr 9, 2013
    We cut the cable TV cord last summer, and have been using OTA TV combined with Netflix on the Apple TV 2nd generation units. So far, it has been working very well.

    I recently added a HDHomerun Dual and EyeTV to the mix, and so far it has been working. I have played with the exporting options for converting the recorded shows and making them available for viewing on the ATVs. My iTunes library is on a separate external drive as my main drive is a SSD. By default with this setup, EyeTV is putting the recordings in my user home directory.

    Has anyone else dealt with changing the export process? I have seen references to using AppleScripts, but have not seen any actual scripts. Does anyone have AppleScripts they would share?
  2. cdavis11 macrumors 6502

    Aug 31, 2009
    There are some triggered scripts that EyeTV can use. You may want to google EyeTV triggered scripts.

    I have a very similar setup, but haven't messed with the destination of the exports. What I have done is install and tune ETVComskip, which makes some mods to the EyeTV triggered scripts.

    If all else fails, you could use Hazel to watch the destination folder for activity and move the file that way.
  3. dgalvan123 macrumors 6502a

    Feb 16, 2008
    Check this thread. Comment #3.

    Starting with that code posted by Heych, I modified and ended up with a script that does both the comskip thing and saves the EyeTV exported recordings on an external hard drive, and imports them to iTunes WITHOUT actually copying the files into the iTunes folder.

    I'm at work so I can't grab my final script and post it right now. Might have a chance to do that tonight. But that thread should get you started. You'll of course need to customize with the directories on your computer/hard drive where you want the files to be stored.

    Couple things:
    1. In iTunes, make sure you have it set to NOT automatically copy contents into the iTunes folder. This way, when you "add to iTunes" in the applescript, the file won't actually be copied into the iTunes folder. Instead, iTunes will just get a link to the file, wherever it is stored.

    2. In EyeTV, turn off all the "export to iTunes" settings for all your shows (often this is in options for your smart guides). The triggered applescript works by noticing that EyeTV has finished recording a show ("on RecordingDone") and then being triggered to export (transcode) the show to an .m4v for iTunes. If you were to leave EyeTV's "export to iTunes" settings on in the EyeTV GUI as well, then you'd be doing the export twice: That is, once the show is finished recording EyeTV would auto-export it, based on your EyeTV settings, AND the triggered Applescript would export it. You don't want to transcode the same show twice, especially since the built-in EyeTV exporting method ALWAYS sends the exported show to either your iTunes Folder or your home/Movies directory.

    So, again, just turn off all the export options in EyeTV. Make EyeTV think you are not doing any exporting at all, and let the Applescript handle that instead.
  4. GarrettL1979 macrumors 6502

    Feb 15, 2012
    I was planning to use a similar setup, but now that Aereo is coming to my town, I might try that out first. Sounds like it will work perfectly for our needs.
  5. mic j macrumors 68030

    Mar 15, 2012
    Same here. Supposedly Aereo will be starting in my area this summer and I am anxious to see if it will be available to me. Also, there is speculation of a new HomeRunHD that will transcode to h.264 on the fly. That would be great if it works. So I am holding off to see whether either of these become an option.
  6. dgalvan123 macrumors 6502a

    Feb 16, 2008
    Do you have to watch the DVR'd Aereo content on your mac? Or is there a way to export it to iTunes so you can watch it on Apple TV? Or can you watch them streamed on your iOS device, and Airplay to Apple TV?

    It sounds like Aereo is basically doing what the HD Homerun / EyeTV / iTunes system already does, with the added constraint that you have to be connected to the internet to use it, and you have to play the DVR'd shows on your mac or iOS device. As opposed to the EyeTV --> iTunes system which lets you watch the recordings directly on your Apple TV, with the files stored on your home system.
    I get why someone who has not yet invested in an HD Homerun, or someone who doesn't have good OTA reception, would be interested in Aereo. But as someone who has both, Aereo doesn't seem to add anything for me. (or does it?)

    The latest on this:
    Yes a new HDHR is being developed that will do onboard transcoding so that the recordings come out native H.264. That is a big benefit for me because it taxes my computer's processor to do all the transcoding from EyeTV to iTunes.

    I also asked if EyeTV would still be compatible with such a new HDHR in the silicon dust forums. The answer came back "we're not sure yet, but we think so".
  7. mic j macrumors 68030

    Mar 15, 2012
    Thanks for the info and insights, both helpful.

    I assumed I would have to airplay the Aereo to the aTV and having to have an internet connection is no biggie. There are only a handful of things I watch on network TV and I don't do it remotely. And yes, I have very very marginal OTA signal. The HDHomeRun would require me mounting an external antenna to get better, but possibly only a little better, OTA signal. That's why the Aereo is interesting to me, no external antenna, no wiring and should be reliable. Also, it's DVR capability is nice. But if I can't airplay to my aTV, it would be useless to me as I never watch tv on my iPad or MBP.
  8. GarrettL1979 macrumors 6502

    Feb 15, 2012
    That's correct. Aereo is working on an iOS app though, which will be nice. ATV adding an app would be even better, but who knows when/if that will ever happen. Aereo has a Roku app already.
  9. dgalvan123, Apr 10, 2013
    Last edited: Apr 11, 2013

    dgalvan123 macrumors 6502a

    Feb 16, 2008
    Hmmm. If someone already has a Roku, that would be a pretty good deal.

    Before I went the HD Homerun / OTA / EyeTV route, I was looking around for a DVR that would record OTA broadcasts, thinking it would be simpler than having my computer in the route.

    The only stable company I found with a DVR that could handle OTA was Tivo. Tivo doesn't make sense because the box itself is expensive: ~$150 for the Premiere, plus $15/month for service. If you want the Tivo experience on two TVs, you have to buy two Tivo Premieres, and pay for service on both of them. (Note the higher-end Tivo Premiere 4 and 4XL don't support OTA input, so the low-end model is your only option).

    So, to have DVR functionality from OTA for my 2-TV household, Tivo would cost me:
    Hardware: $300 (2 Tivo Premieres)
    recurring costs: $30/month for service for both units.

    By comparison, the HD Homerun / EyeTV / Apple TV combo cost me:
    Hardware/Software: $180 (for HDHR and EyeTV)
    recurring costs: $1.67/month for TV Guide service ($20/year)

    (note: I already had an Apple TV for each TV, since the original reason we purchased them was to enjoy our home photos and home videos, airplay, and netflix. Adding two Apple TVs to hardware costs raises it to $380. But in that case the Tivo option is still more expensive after only 3 months due to the monthly service fees.)

    Now, with Aereo, it sounds like you could have the DVR service for OTA shows for something like $80/year with their most economical "full-featured" package. And you can watch them on a Roku or the ATV (via airplay from iOS devices).

    So, for my household, costs would be:

    Hardware: ~$200 (for 2 rokus but this is optional as I could see if it bothers me to use my existing iOS devices and ATV)
    recurring costs: $6.67/month ($80/year)

    Still more expensive in the long run by ~$5/month ($60/year). But it would save me from having to think about storage and transcoding of the EyeTV/iTunes shows.

    Aereo is certainly worthy of consideration cord-cutters consideration if it is available in your city (I'm in Los Angeles so it's not an option here). Especially if you already have either 1. A Roku, or 2. an iOS device and Apple TV and don't mind having to airplay all the time.
  10. cpeek thread starter macrumors newbie

    Apr 9, 2013
    dgalvan123 - I would be very interested in the scripts and comskip settings that you are using.

    I will search on the other suggestions and see what I can find.

    I also looked at the variety of options - Tivo, future concepts such as Boxee and Aereo, etc. and determined that this was the best place to start. This was the cheapest working solution available today. My backup plan would be to try the Windows Media Center or MythTV on a Mac Mini if this does not work.

    I plan to look again when Aereo and Boxee arrive in my area just to see if they make sense. However, the Apple TV interface works very well as the family is familiar with using it. Since most everything else we use is wrapped into the Mac OS, various i devices, Apple TV, etc., this makes a lot of sense. Introducing a new separate box into the process brings a whole host of issues - remotes (either multiple or buying Harmony programmable remotes for rooms), teaching about changing inputs, how to troubleshoot when something does not work right, etc.

    The ideal would be a Apple TV based DVR concept, and I hope that comes at some point in the future.
  11. aristobrat macrumors G5

    Oct 14, 2005
    FWIW, the TiVo Premiere 4 (and 4XL) don't have OTA tuners, which kills using the TiVo mini for cord cutters. :(
  12. dgalvan123, Apr 11, 2013
    Last edited: Apr 11, 2013

    dgalvan123 macrumors 6502a

    Feb 16, 2008
    Ah. Didn't know that.

    Looked back on the Tivo page and you are indeed correct. Only the low-end model (Tivo Premiere) can handle OTA input. So, for a two TV household, you'd need two Tivo Premieres (2 x $150 = $300). Actually that's cheaper for hardware than getting a single Tivo Premiere 4 and a Tivo Mini ($250 + $100 = $350), but more expensive in recurring costs ($30/month for 2 Tivo Premieres, $21/month for a Premiere 4 and Tivo Mini), so it ends up costing more overall in 6 months ($9 difference x 6 months = $54. $54 > $50 difference in hardware costs.) I edited my previous posts to correct the numbers.

    I am confused as to how Tivo has managed to stay in business at these prices. They were undercut by the cable/sat companies who rent a DVR to customers for $6-$10 / month (less than Tivo's service fee, let alone hardware cost). And they aren't even really a sensible option for cord-cutters. So who uses these things?
  13. GarrettL1979 macrumors 6502

    Feb 15, 2012
    i've often wondered the same.
  14. aristobrat macrumors G5

    Oct 14, 2005
    First off, I'm not a cord-cutter, so I apologize in advance.

    I have a TV-addicted roommate who watches a ton of non-OTA stuff, and he'd rather cover 90% of the cost of cable than cut the cord. I'm selfishly fine with that. :)

    I live in a 4-DVR house. One in the living room, one in my bedroom, one in the roommate's bedroom, and one in the guest room <somewhat embarrassingly, there're enough guests to warrant that>.

    The cable company here (Cox) charges $8.50/mo for a HD "box", plus $9.99/mo extra to enable the DVR feature on that box. So basically, a Cox DVR costs $18/month -- forever.

    With TiVo, you can either pay for the TiVo Service (which consists of guide data + quarterly software updates <for as long as your device is supported>) monthly (forever, just like with the cable company's DVR), or you can lay down a large chunk of money up-front for something called "Lifetime Service". If you pay for Lifetime Service, there are no monthly TiVo fees for that device.

    If we used Cox's DVRs, there'd be four DVRs in the house. That'd cost $72/month, forever.

    Instead, we use:

    $399 - TiVo 4 XL <four-tuner box, in Living Room>
    $400 - Lifetime Service for TiVo 4 XL
    $249 - TiVo 4 <two-tuner box, in roommates room>
    $400 - Lifetime Service for TiVo 4
    $99 - TiVo Mini <in my room, can pull off of either TiVo above>
    $150 - Lifetime Service for TiVo Mini
    $99 - TiVo Mini <in guest room, can pull off of either TiVo above>
    $150 - Lifetime Service for TiVo Mini
    $1946 total

    That's a large sum of cash to outlay, but the only extra DVR-related monthly fee is $3.99/month to Cox for two cable cards <one for each TiVo 4>.

    Compared to Cox's perpetual DVR monthly fees, TiVo completely pays for itself in ~28 months, and then saves me $68/month every month after that.

    To a cord-cutter, both scenarios probably seems absurd. :D Works well in my house, though! :)
  15. dgalvan123 macrumors 6502a

    Feb 16, 2008
    Here's the triggered script I'm currently running. This needs to sit in:
    Macintosh HD/Library/Application Support/EyeV/Scripts/TriggeredScripts/

    I haven't messed with this in a while, and the comskip part is not really working as well as I'd like. But I think it's the export part that is most important for you. That's just the first section: everything before the "end RecordingDone" line.

    So basically this script senses when a recording is finished, and then exports it to a particular destination folder. For me it was "Storage_1TB:EyeTVExports:". Again, you'll want to turnoff the auto-export function in EyeTV if you use this, otherwise you'll get two transcodes.

    -- Run the python MarkCommercials script for the given recording
    -- this must be run with the RecordingStarted script
    -- it will check if there were multiple PIDs for the recording and runs MarkCommercials for each pid
    -- requires updated MarkCommercials which allows specifying the pid
    -- by Ben Blake, September 2009
    global LogMsg
    on RecordingDone(recordingID)
    	set LogMsg to ""
    	--disable this if you do not want a logfile written
    	if (count of LogMsg) > 0 then
    		write_to_file((short date string of (current date) & " " & time string of (current date)) & LogMsg & (ASCII character 13), (path to "logs" as string) & "EyeTV scripts.log", true)
    	end if
    	--This is the extra part that will export the recording to iTunes, while keeping the iTunes-transcoded version on the external hard drive. This was thanks to a macrumors post here: http://forums.macrumors.com/showthread.php?t=1348824
    	set destFolder to "Storage_1TB:EyeTVExports:"
    	tell application "EyeTV"
    		set myid to recordingID as integer
    		set thisTitle1 to title of recording id myid
    		set thisTitle1 to my parseout(thisTitle1)
    		--Note the below line uses the episode title in the filename.  It was causing some problems and not allowing the script to continue. I think it may be due to not all channels listing the episode title properly? If you really want episode title in the filename, google around and see how others do it.  Someone has an if statement where if the episode title is "" (ie: there is none) then do the id number thing, otherwise use episode title.
    		--set thisTitle2 to episode of recording id myid as text
    		set thisTitle2 to unique ID of recording id myid
    		set thisTitle to thisTitle1 & " - " & thisTitle2
    		export from recording id myid to file (destFolder & thisTitle & ".m4v") as AppleTVHD --replacing yes
    		--Now add the file to iTunes.
    		tell application "iTunes"
    			add (destFolder & thisTitle & ".m4v")
    		end tell
    	end tell
    end RecordingDone
    --Subroutine to remove troublesome characters
    to parseout(stringtoparse)
    	set illegals to (ASCII character of 60) & (ASCII character of 62) & (ASCII character of 58) & (ASCII character of 34) & (ASCII character of 47) & (ASCII character of 92) & (ASCII character of 124)
    	repeat with i from 1 to count (illegals)
    		set testletter to (text i thru i of illegals)
    		set the_offset to 1
    			set the_offset to offset of testletter in stringtoparse
    			if the_offset > 0 then
    				set stringtoparse to (text 1 thru (the_offset - 1) of stringtoparse) & "" & (text (the_offset + 1) thru -1 of stringtoparse)
    				exit repeat
    			end if
    		end repeat
    	end repeat
    	return stringtoparse
    end parseout
    -- testing code: this will not be called when triggered from EyeTV, but only when the script is run as a stand-alone script
    on run
    	tell application "EyeTV"
    		set rec to unique ID of item 1 of recordings
    		my RecordingDone(rec)
    	end tell
    end run
    on CheckMultiplePIDs(recordingID)
    	--check if there are multiple Video PIDs in the file
    	tell application "EyeTV"
    		set input_text to my read_from_file((path to "logs" as string) & "ETVComskip" & ":" & recordingID & "_comskip.log")
    		if (count of (input_text as string)) > 0 then
    			set logdata to every paragraph of input_text
    			set logdata_lastrow to (item ((count of logdata) - 1) of logdata) as string
    			if (items 1 thru 19 of logdata_lastrow) as string = "Video PID not found" then
    				--multiple Video PIDs, rerun MarkCommercials until successful
    				set recrdingIDInteger to recordingID as integer
    				set rec to recording id recrdingIDInteger
    				set LogMsg to "RecordingDone found multiple PIDs for recording ID: " & recordingID & ", Channel " & (channel number of rec) & " - " & (title of rec)
    				set PIDs to (items 44 thru ((count of logdata_lastrow) - 2) of logdata_lastrow) as string
    				set delims to AppleScript's text item delimiters
    				set AppleScript's text item delimiters to ", "
    				set PID_List to {}
    				set PID_List to every word of PIDs
    				set AppleScript's text item delimiters to delims
    				repeat with pid in PID_List
    					my launchComSkip(recordingID, pid)
    					repeat while (my mcIsRunning())
    						delay 5
    					end repeat
    				end repeat
    			end if
    		end if
    	end tell
    end CheckMultiplePIDs
    on read_from_file(target_file)
    	--return the contents of the given file
    	set fileRef to (open for access (target_file))
    	set txt to (read fileRef for (get eof fileRef) as «class utf8»)
    	close access fileRef
    	return txt
    end read_from_file
    on write_to_file(this_data, target_file, append_data)
    	--from http://www.apple.com/applescript/sbrt/sbrt-09.html
    		set the target_file to the target_file as string
    		set the open_target_file to open for access file target_file with write permission
    		if append_data is false then set eof of the open_target_file to 0
    		write this_data to the open_target_file starting at eof
    		close access the open_target_file
    		return true
    	on error
    			close access file target_file
    		end try
    		return false
    	end try
    end write_to_file
    on launchComSkip(recID, pid)
    	if pid = "" then
    		set cmd to "'/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log " & recID & " &> /dev/null &"
    		set cmd to "'/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log " & recID & " --pid=" & pid & " &> /dev/null &"
    	end if
    	do shell script cmd
    end launchComSkip
    on mcIsRunning()
    	set processPaths to do shell script "ps -xww | awk -F/ 'NF >2' | awk -F/ '{print $NF}' | awk -F '-' '{print $1}' "
    	return (processPaths contains "MarkCommercials")
    end mcIsRunning

Share This Page