Transferring Tivo episodes to your iPhone with a Mac and PC

If you’re like me and you own a Tivo HD/Tivo Series3 and an Apple iPhone/iTouch/iPod, you may be wondering, can I transfer shows from my Tivo to my portable device? The answer is yes, although the path you choose depends a lot about your home setup. For example, I have a MacBook and a PC. The MacBook is what I use to sync to my iPhone, but laptops have limited space, so I use my PC to transfer the gigabytes of data from my Tivo. Combining the two work together can be a daunting task so I’ve written this guide of my experience to help people in similar circumstances. Once set up the results are spectacular, gigabytes of data are transferred from my Tivo to my PC, automatically converted to Apple iPod format, and the most recent episodes are automatically transferred to my iPhone, whenever I sync my iPhone to my Mac.


Part 1: Setting up your PC for the Tivo Transfer

The Tivo and PC part of the equation is pretty straight-forward even if the Apple/iTunes can be a bit more challenging. First off, you need a PC to download and convert the files to work on your iPod. For whatever reason, Tivo has developed the PC version with many amazing features, but has yet to put them in the Mac version. They do suggest Roxio Toast Titanium but I’ll leave it to someone else to write a guide for this software. Back to the PC version… for a one-time fee of $24.95 you can purchase an unlock key of Tivo Desktop Plus for PC. Once installed and configured with a Media Key for your specific Tivo, you can select “Auto-Transfers”, select shows you’ve previously records, and have it download new episodes of shows automatically. Its equivalent to a download-form of a Tivo ‘season pass’. You can then open Tivo Desktop and go to Preferences -> Portable Devices and set it to convert it to Apple iPod as well as delete the original larger file. This saves a ton of space since it only keeps the final, converted item.

Some reasons why I use a PC for the transfer? My PC has terabytes of data, my MacBook does not. So even if they had a native Mac version, I’d still use my pc.


Part 2: Setting up your Mac for the iTunes Import

If you followed part one you now have a single folder filled with Apple-formatted shows. If you’re like me you set them on a read-only network share for other computers in your home to use (and open the Keychain Application on a Mac to set the share to no longer prompt for a username/password). Now we move on to the Mac side of things…

While I like my PC for the transfer and storage part, I prefer my Mac to sync my iPhone. If you go into iTunes preferences -> Advanced, there’s an option “Copy files to your library when adding to Library”. For the purposes of this explanation we’re going to assume you turn this off so that when you add a file from the external share, only a reference is copied. The file stays on the network share. With this setting turned off you can open iTunes and go to File -> Add Folder to Library, select the network share, and it will add all the files in the folder to your iTunes library. But there’s a few catches:

1) This process is not automated, future files will not automatically be detected and added
2) Sometimes iTunes screws up and lists files twice
3) Some shows (like daily show) requires name changes because it saves the name of *every episode* as “The Daily Show with …” making it impossible to read on you iPhone.

For that I’ve written an Apple script that fixes all the problem above (see appendix). I set it on a cron job to occur every 15 minutes (search google for instructions on using/running crontab on a Mac), first checking to make sure iTunes is open and the network share exists. If all this is in place, you’ll have your iTunes library constantly updated any time it is at home, the network is connected, and iTunes is up. I also set up a separate apple script to reconnect the network drive on computer startup (see appendix).

It takes a little practice but AppleScript is an extremely simple language to work with. After you download the script, read it over and learn what each line means. This way you can modify it to fit your custom situation as needed. I take no responsibility if this script, or your modified version of it, does anything bad to your computer or your files. Use at your own risk.


Part 3: Setting up your iPhone

Finally, the ‘easy’ part. With all this set up, your Mac will now contain references to recently converted shows (usually delayed about 45 mins from actual airtime completion). If you leave your pc and Mac on all the time, this will happen while ya sleep.

The final part is to configure your iPhone, of which I do have some advice. For starters, iTunes is a tad novice-level in that you can either choose to transfer a playlist of tv video files XOR transfer recent episodes of tv shows. The exclusive “XOR” is because you cannot do both (as I said, the Apple/iTunes side is more of a pain). For simplicity, I like transfer the “3 most recent episodes” of “selected tv shows”. The only thing that can screw this up, really, is if Tivo suggestions records like 10 episodes of a show you didn’t want it to. For example, Comedy Central likes to air the Daily Show 5-10 times a day, so its possible, albeit unlikely for your to have multiple copies of the same episode on you iPhone (if you want to disable it all together just rate the Daily Show with 3 thumbs down or turn Tivo Suggestions off).

The result? Every morning I connect my iPhone to my Mac and it instantly downloads all of last nights programming including new episodes of daily show. I can then watch them on my commute. All of the setup is a little painful but the PC never needs to be touched once your auto-transfers are set up. The Mac is a little more unfriendly, in that you may have to run the script manually if you are in a hurry and forgot to leave your computer on over night.


Appendix: AppleScript code

Applescript to load share automatically on computer startup. You can use System Preferences auto-start to make it startup.

tell application "Finder"
open location "smb://ip-address-for-pc/my-ipod-share"
end tell

AppleScript to import and cleanup Tivo Files. Also available here: tivo-script.txt

-- syncPcTivoToApple v 1.0 - An AppleScript to automatically import a network
-- share of PC transferred iTune files to your Mac.
--
-- Copyright 2011 Scott Selikoff

-- Video Format
property format_items : {"MPG4"}

-- File extensions
property ext_items : {"mp4"}

-- Whether or not to perform import
property okflag : false

-- List of 'special' shows
property convertNameToDateRecordedIdentifiers : {"The Daily Show With Jon Stewart", "The Colbert Report"}

on run

-- Set name of network share via the file system
set network_folder to "my-ipod-share"

-- Proceed if network share exists and iTunes is open
tell application "Finder"
set okflag to ((exists folder network_folder) and ((get name of every process) contains "iTunes"))
end tell

if okflag then
import_files_to_itunes(network_folder)
remove_duplicates("TV Shows")
clean_track_name("TV Shows")
end if
end run

-- Perform Import
on import_files_to_itunes(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & ":" & (item i of these_items))
set the item_info to info for this_item

if (alias of the item_info is false) and
((the file type of the item_info is in the format_items) or
the name extension of the item_info is in the ext_items) then
tell application "iTunes"
add this_item to playlist "Library" of source "Library"
end tell
end if
end repeat
end import_files_to_itunes

-- Cleanup library of diplicates
on remove_duplicates(this_playlist_name)
tell application "iTunes"
set this_playlist to user playlist this_playlist_name
set all_tracks to the number of this_playlist's tracks
set temp1 to {}
set delete_list to {}

if all_tracks > 1 then
set this_location to the location of track 1 of this_playlist
repeat with i from 2 to all_tracks
set next_location to the location of track i of this_playlist

if this_location is equal to next_location then
copy i to end of delete_list -- then this track is a dupe; copy its index to our delete_list list
end if

set this_location to next_location
end repeat

-- total number of tracks to nix for dialog
set to_nix to delete_list's length

--If you must delete, do it backwards, ie:
repeat with x from to_nix to 1 by -1
copy (item x of delete_list) to j
delete file track j of this_playlist
end repeat
end if
end tell
end remove_duplicates

-- Cleanup special tracks
on clean_track_name(this_playlist_name)
tell application "iTunes"
set this_playlist to user playlist this_playlist_name
set all_tracks to the number of this_playlist's tracks

repeat with i from 1 to all_tracks
set artistName to the artist of track i of this_playlist
set titleName to the name of track i of this_playlist

if ((titleName begins with artistName) and (titleName contains "\"")) then
if (artistName is in convertNameToDateRecordedIdentifiers) then
-- Case 1:  Daily Show and Colbert Report, just use date as name
set pos1 to ((length of artistName) + 2)
set pos2 to ((length of artistName) + 9)
else
-- Case 2: All other shows strip out the artist name and date
set pos1 to ((length of artistName) + 12)
set pos2 to ((length of titleName) - 1)
end if

-- Position invariants must quality for renaming
if ((pos1 < pos2) and (pos1 < (length of titleName)) and (pos2 > 1)) then
set newTitleName to (text items pos1 thru pos2 of titleName) as text
set name of track i of this_playlist to newTitleName
end if
end if
end repeat
end tell
end clean_track_name