I have quite a simple problem. I want to put the audiofiles into my table view. How do I distinguish them from pdfs and movies, etc?
I get them from iTunes over Scripting Bridge:
iTunesSource *source = [[[self iTunes] sources] objectAtIndex:0];
iTunesPlaylist *mainPlaylist = [[source libraryPlaylists] objectAtIndex:0] ;
library_ = [[NSArray arrayWithArray:[mainPlaylist tracks]] retain ] ;
This gives me an error saying the class iTunesFileTrack could not be found ( at linking time) :
[track get];
if(![track isKindOfClass:[iTunesFileTrack class]]) {
DLog1(@"SKIPPING kind: %@", [track kind]);
}
I'm sure I'm missing something simple :)
On a related note: Is there a faster way to read the iTunes library? I just advice on loading it from an xml file but that seems unsafe to me. If apple changes anything in the next release I'm screwed.
Thank you
EDIT: With sdef /Applications/iTunes.app | sdp -fhm --basename iTunes
I can generate the .m file I need to check for the class. But it does not seem to work:
[track get];
if(![[track className] isEqualToString:@"ITunesFileTrack"]) {
DLog1(@"SKIPPING kind: %@", [track kind]);
continue;
}
Skipps just my streams :P Not the movies. (Even when I add (track.videoKind != iTunesEVdKNone)
). Even the PDF's are iTunesFileTracks. But the .h states:
// a track representing an audio file (MP3, AIFF, etc.)
@interface iTunesFileTrack : iTunesTrack