Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mmmdreg

macrumors 65816
Original poster
Apr 14, 2002
1,393
0
Sydney, Australia
I'm a total script kiddie when it comes to cocoa so I was wondering if someone can shove me in the right direction regarding parsing the iTunes xml file for data on all the songs so that I can use them for something else?
 

mj_1903

macrumors 6502a
Feb 3, 2003
563
0
Sydney, Australia
NSDictionary ;)

Location of the iTunes Music Library file is nearly always ~/Music/iTunes/iTunes Music Library.xml.

To load this:

[NSDictionary dictionaryWithContentsOfFile:[@"~/Music/iTunes/iTunes Music Library.xml" stringByExpandingTildeInPath]];

Open the xml file in property list editor to see the layout, but the main keys that you will want are "Tracks" and "Playlists".
 

mj_1903

macrumors 6502a
Feb 3, 2003
563
0
Sydney, Australia
mmmdreg said:
hehe but how do I take those values out? =)

Did you look in the documentation? It is quite obvious. :)

Methods like:

Code:
- (id)objectForKey:(NSString *)aString

for NSDictionary's or

Code:
- (id)objectAtIndex:(int)anIndex

for NSArray's.
 

sicojola

macrumors newbie
Nov 24, 2005
1
0
mj_1903 said:
NSDictionary ;)

Location of the iTunes Music Library file is nearly always ~/Music/iTunes/iTunes Music Library.xml.

To load this:

[NSDictionary dictionaryWithContentsOfFile:[@"~/Music/iTunes/iTunes Music Library.xml" stringByExpandingTildeInPath]];

is there an easy way to do this using java instead of obj-c?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.