title: How do I get just the audio files from the iTunes main library (returned by Scripting Bridge)?
body: <p>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?</p>
  
  <p>I get them from iTunes over Scripting Bridge:</p>
  
  <pre><code>    iTunesSource *source = [[[self iTunes] sources] objectAtIndex:0];
      iTunesPlaylist *mainPlaylist = [[source libraryPlaylists] objectAtIndex:0] ;
      library_ = [[NSArray arrayWithArray:[mainPlaylist tracks]] retain ] ;
  </code></pre>
  
  <p>This gives me an error saying the class iTunesFileTrack could not be found ( at linking time)
  :</p>
  
  <pre><code>[track get];
  if(![track isKindOfClass:[iTunesFileTrack class]]) {
      DLog1(@"SKIPPING kind: %@", [track kind]);
  }
  </code></pre>
  
  <p>I'm sure I'm missing something simple :)</p>
  
  <p>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.</p>
  
  <p>Thank you</p>
  
  <p>EDIT: With <code>sdef /Applications/iTunes.app | sdp -fhm --basename iTunes</code> I can generate the .m file I need to check for the class. But it does not seem to work:</p>
  
  <pre><code>[track get];         
  if(![[track className] isEqualToString:@"ITunesFileTrack"]) {
      DLog1(@"SKIPPING kind: %@", [track kind]);
      continue;
  }
  </code></pre>
  
  <p>Skipps just my streams :P Not the movies. (Even when I add <code>(track.videoKind != iTunesEVdKNone)</code>). Even the PDF's are iTunesFileTracks. But the .h states:</p>
  
  <pre><code>// a track representing an audio file (MP3, AIFF, etc.)
  @interface iTunesFileTrack : iTunesTrack
  </code></pre>