# Mac TiVo Desktop iTunes Cache - How to Reset?



## DaveTheNerd (Oct 13, 2004)

Ok... this gets a little involved, so I'll ask the question up front, then explain why I'm asking it.

The Mac version of TiVo Desktop keeps a persistent cache of all the tunes in your iTunes library, one that lasts even beyond restarts of the machine. Anyone know the "official" method of purging and rebuilding this cache?

Today I went to play music on our TiVo. I navigated to the song successfully, but when I hit the song in question, it would show the "time bar" at the bottom, but never get off 0... it would never start playing. I tried this with about 10 different songs on the MacBook Pro, none of them worked. I got frustrated, and tried this on my G5 iMac... went to play one song... same problem. So I called TiVo support. An hour on the phone had me reboot both my Macs, the router, and TiVo multiple times, all to no avail.

Then, on the iMac, I tried a different song, and it played. I told TiVo support this, and then scratched their heads... I realized that the original song I was trying to play on the iMac wasn't there (iTunes couldn't find it, either)... no wonder TiVo couldn't play it! So TiVo would play anything on the iMac, but still nothing on the MacBook Pro (even songs that iTunes could successfully play).

TiVo support told me to shut everything down, start up the router, then TiVo, then the computers, etc. Knowing that this likely wouldn't solve anything, I asked them, "then what? It sounds like there's a problem where the MacBook Pro isn't finding the songs." Once they confirmed iTunes could find them, they said that it should work fine, and deftly navigated me... off the phone.

Frustrated, I set to work. I stumbled upon this other thread that gave me an indication as to how to turn on logging. I did this, and sure enough, saw that when I went to play the song, TiVo Desktop was logging a "file not found" message. In looking at the logs, I realized it was trying to pull the song files from my iTunes Music folder in my home directory, and iTunes doesn't store anything there: it stores its stuff on an external drive.

Now, mind you, TiVo Desktop has successfully played the songs from the external drive many times in the past. For some reason, today it decided to start looking at the internal drive.

So at this point, I began a quest to figure out how to tell TiVo Desktop to "relearn" the locations of the files. As I said, restarting the engine OR the computer didn't help, so I was at a bit of a loss. During this, I told TiVo desktop to only show songs from a single playlist. Then, I told it to go back to the whole library. This, for whatever reason, forced a "rebuild" of the file-location cache (for lack of a more accurate term). Now, everything seems to work fine...

... but my "rebuild technique" is far from perfect, hence my original question: how do I *properly* rebuild that cache?

Thanks!

-Dave


----------



## Dennis Wilkinson (Sep 24, 2001)

There's no such cache, or I should say, not one that TiVo manages. It reads the one used by the iApps themselves.

It first looks in the iApps prefs for the most recent file. To see the files the iApps are tracking, you could run the following at a command line (in Terminal, for example):


```
defaults read com.apple.iapps iTunesRecentDatabases
```
If it fails to locate a file using that method, it falls back to one of two places:

(your home dir)/Documents/iTunes/iTunes Music Library.xml
(your home dir)/Music/iTunes/iTunes Music Library.xml

As you've discovered, turning on logging can help you figure out which file got selected. If the wrong one is being picked, the first thing I'd try is to reset the path to your music folder in iTunes Advanced Prefs, which should update the information in the iApps preferences appropriately. From your description, it sounds like the iApps prefs may have not been pointing to your external drive, or using a stale path, something along those lines, so the fallback location get used instead. It's not clear to me why the "switch to single playlist and back" trick worked, but it's good that you have things working again.


----------



## DaveTheNerd (Oct 13, 2004)

Thanks for the detailed response, Dennis. I do have one lingering curiosity:



Dennis Wilkinson said:


> There's no such cache, or I should say, not one that TiVo manages. It reads the one used by the iApps themselves.


Are you sure about this? Because when this was happening (i.e. when TiVo was looking in the wrong place), all of the following worked:

Playing the same song with iTunes locally
Playing the same song shared from another iTunes instance on the network
Doing a "get info" on the song in iTunes revealed its correct location.

Remember, I rebooted the Mac containing this particular song multiple times, and though iTunes would see it just fine after reboot, TiVo *still* wouldn't... until I did the hokey pokey with the selected/all playlists.

And, the other thing: at no time (never ever) was the song located in my home directory where TiVo was looking for it. It was *always* on the external drive. So there's no reason for iTunes cache to ever have had it listed anywhere else.

<gasp> it just hit me: is TiVo assuming that ALL songs are in the same directory? I'm sure I have *some* songs in my iTunes home folder (things that I've ripped while disconnected from the firewire drive, etc), and the rest on my external. I sure hope that TiVo Desktop is smarter than to make that assumption.

-Dave


----------



## Dennis Wilkinson (Sep 24, 2001)

DaveTheNerd said:


> Are you sure about this? Because when this was happening (i.e. when TiVo was looking in the wrong place), all of the following worked:
> 
> Playing the same song with iTunes locally
> Playing the same song shared from another iTunes instance on the network
> ...


Yes, I'm sure. Rebooting would have nothing to do with it; the particular preference being looked at isn't affected by a reboot.

Remember, the TiVo software doesn't look for song files; it looks for the XML version of your iTunes Library (usually ~/Music/iTunes/iTunes Music Library.xml). That file contains absolute file URLs for the individual song locations. iTunes, however, doesn't use that XML file itself; rather, it uses a binary form of the file (usually ~/Music/iTunes/iTunes Library). iTunes is supposed to keep these files in sync, but I suppose it's possible for there to be issues there, depending on how you're using that external drive. Other things with a library on an external drive might get wonky, too: the mount point for that drive could, in theory, change, rendering all those paths invalid.

My understanding is that the other iApps use the XML file and not the binary form as well. I'd be interested to know if iPhoto or iDVD also has trouble with those same songs when Tivo Desktop does.

TiVo Desktop makes only one assumption about song file locations that I can see, and that is that those files are where the iTunes XML file says they are. The only "caching" of the file locations is in memory while the TiVo Desktop application is running.

FYI, Only 1 file changes when you do the "share all/share these playlists" twiddle in the TiVo pref pane, and that is ~/Library/Preferences/com.tivo.desktop.plist, which has no references to the file system related to iTunes. Changing this will cause TiVo Desktop to re-parse its preferences and re-find and parse the iTunes XML file, but this won't be any different than what happened at boot time unless you've doing something in iTunes itself that causes either changes to that file or marks a different file as "more recent" in the iApps prefs.


----------

