Having trouble with Lostify’s iTunes integration?
I’ve been in communication with a handful of users experiencing some technical issues with Lostify. While work is progressing on the next release, I’ve taken time out to put together a couple small utilities to try to help these folks work around the existing issues. This post is about one of these two new “workaround” utilities: MetaFreshen.
Lostify’s iTunes integration apparently fails for a handful of users. When you enable the feature to run Lostify from within iTunes, or to have Lostify add tagged tracks to iTunes automatically, these users begin getting errors like “Can’t get track 1 of library playlist 1 whose database ID of it = xxxxx”. Extensive efforts to debug this problem have proven fruitless; it appears to be a bug in iTunes’ AppleScript support. If this error happens to you frequently in Lostify, please let me know and I’d be glad to work with you to research the issue… but until we can discover the root cause and address it, I may have a temporary solution for you in the form of MetaFreshen.
MetaFreshen is an AppleScript that runs completely from within iTunes (thus working around the bug). It reads the full-length description out of the selected MP4 file(s) and set iTunes’ long description field appropriately. This means you can get the nifty little “i” button on your own movies and TV shows, not to mention descriptions that are over 255 characters. As you probably know, this is normally done by Lostify itself, but (as mentioned above) this is only useful in situations where that integration is failing for reasons unknown.
After downloading and unzipping MetaFreshen, simply install it in the ~/Library/iTunes/Scripts folder. You run the script by choosing MetaFreshen from the scripts menu inside iTunes. There is no user interface; it should simply run and quietly update the description for each selected file. I hope it’s helpful to someone.

February 11th, 2008 at 4:15 pm
“these users begin getting errors like “Can’t get track 1 of library playlist 1 whose database ID of it = xxxxx”.”
Older versions of iTunes used a 64-bit integer for database IDs. This isn’t a problem for languages such as Python and Ruby that can represent integers of any size. AppleScript integers are limited to 30-bit, however, and anything larger gets coerced to an AppleScript real, which only has 50-bit precision so there’s often some loss of accuracy that renders numerical database IDs completely useless.
Solutions:
1. Make sure you’re using iTunes 7.5 or later. iTunes 7.5+ represents database IDs as hex strings which AppleScript can’t screw up.
2. Switch to Python/Ruby/ObjC and appscript (see my sig), which provides non-lossy mappings between native and Apple event integer types.
3. Rewrite your AppleScript so that it doesn’t use the ‘database ID’ property.
HTH
has
–
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
February 11th, 2008 at 10:17 pm
Hi! Thanks again for looking into this! I was one of the ones that mentioned this problem awhile back (I’ve been busy and unable to respond or post more about it - sorry!)
I thought the problem was solved when I installed Leopard, but sadly it came back. Sometimes it comes and goes, and seems to be whenever I want to Lostify something newly added to iTunes.
If there’s any info I can add that would help, please let me know (though I’m a total newb at much of this.)
And again, thanks for a truly wonderful app!
February 11th, 2008 at 11:48 pm
has… thanks for the great information! It hadn’t occurred to me that the database IDs might be overrunning a 30-bit integer. Can that really be true? Of course I have no idea how iTunes assigns these IDs internally, but perhaps some user actions (consolidating or moving your library, etc.) could conceivably cause iTunes to reassign database IDs in such a way that the numbers could climb a lot bigger than the number of items in your library. Me personally, I don’t think I’ve seen any database IDs in my library over 6 digits (which would fit in 20 bits). Do database IDs for some users really exceed 1,073,741,842?
Another reason this never occurred to me was that the database IDs typically reported in the error messages (can’t get track 1 of library playlist 1 whose database ID = xxxxx) were usually just 4- or 5-digit numbers, nothing even close to any limits. Maybe these numbers were actually incorrect, the result of some truncation that happened internally when I coerced a really large value into an AppleScript integer? Never thought of that.
At any rate, I’ve been doing some performance testing on the idea of using the newer “Persistent ID” instead of the “Database ID” for these lookups. On my machine (2.4 GHz Core 2 Duo w/2GB RAM) and with my iTunes database (7000+ items), lookups by Database ID via AppleScript take about 0.11 seconds average. Lookups by Persistent ID appear to take about 60% longer — on average about 0.18 seconds. So not quite as quick, but still better than most other ways of looking up tracks via AppleScript. I guess I’ll try using the Persistent ID in the next release. Thanks again, has.
February 11th, 2008 at 11:50 pm
NONfinis… if you don’t mind my asking, approximately how many items do you have in your iTunes library?
February 14th, 2008 at 7:41 am
Roughly speaking, I have about 6200 items in my library (music+tv shows+movies).
One thing I noticed, which may or may not be of any use: the problem with lostify not working in iTunes (ie having that error pop up) seems to always happen with newly added items to the library. Occasionally it seems to work with items that I have added but haven’t gotten around to tagging until I’ve added more things into the library (making those first added things no longer the most recently added item).
I hope that garbled mess of words made sense.
- Jeff/NONfinis
February 14th, 2008 at 1:03 pm
It’d like to request a feature which trashes the created file after it is added to iTunes. I have set iTunes so that it automatically manages my library, i.e. it copies all files which are added to the iTunes Music folder. This means that the files Lostify just created can be trashed after being added to iTunes.
March 6th, 2008 at 4:36 pm
Metafreshen is a great little script. I spent a ton of time using Lostify to add my tags and long descriptions how ever due to running out of drive space I migrated a bunch of files to a larger drive and I was dismayed when my long descriptions were missing. Metafreshen saved me a ton of time by not having to rerun Lostify to fix something that was already there.