Currently I'm loading the iTunes XML library using -[NSDictionary initWithContentsOfFile:] but for my iTunes library, even a reasonably small one, the file weighs in at just over 4 MB.

This causes a noticeable pause in my application because it has to parse the entire file. I'm looking for an alternate method primarily because it is loading all the song entries when all I need are the playlists. Using the ScriptingBridge isn't possible because I don't want to have to open iTunes just to get a list of playlists.

Based on the discussion of creating strings from the mapped data I considered attempting to open the file, map it into an NSData instance, scan through it to find the keys I need incrementally thus avoiding having to load the whole file, then closing it. The only problem however is that iTunes periodically replaces this file, if this were to happen whilst I have the original mapped, would my app crash? Essentially, whilst I have the file open, will it remain readable?

Or is this approach potentially even more time consuming that simply letting NSDictionary load the entire file into memory?

Keith
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to