Commercial Skipping with QuickTime Player a.k.a. Poor Man's TiVo #

With the help of my Formac Studio and Vidi (since Formac's programmers are incompetent and want more money for software that works with the current release of Mac OS X) I've been watching TV on my Mac. Vidi supports a basic recording mode (even with channel switching when using the Studio's TV tuner), but playback via QuickTime Player leaves something to be desired, especially for someone used to the TiVo UI (with the 30-second skip hack of course).

Recalling that QuickTime Player is AppleScriptable, I decided to at least cobble together a 30-second commercial skipping function. A short while later I had the following script:

tell application "QuickTime Player"
	if not (exists movie 1) then return
	set theMovie to movie 1
	stop theMovie
	set currentTime to theMovie's current time
	set timeScale to theMovie's time scale
	set the current time of theMovie to currentTime + 28 * timeScale
	play theMovie
end tell

(Technically it skips 28 seconds due to human reaction time and the execution latency; this number may need some tweaking). Now that I had the script (which ran as expected when executed from the Script Editor) I needed some way to invoke it from the QuickTime Player. I initially tried adding it to the Script Menu, which although worked as expected, provided no way of attaching a keyboard shortcut. This tip suggested that it might be possible, but even after restarting SystemUIServer (which acts as a host for the Script Menu extra) the key shortcut only worked when the cursor was over the menu extra area.

Presumably a third party solution like iKey could be used, but I wanted to see if I could make do with what I already had installed. It turned out that the Microsoft Mouse software supports attaching applications to the mouse's buttons. Wrapping the above script on a on reopen/end reopen block and saving it as an application that stays open and has no startup screen worked pretty well. The reopen block and the "stay open" option are necessary since launching the script on every click would take too long. Presumably a timer that quits the script after a certain level of inactivity (e.g. QuickTime Player is quit) would be even more elegant, so that the Dock isn't littered with another icon).

Post a Comment