I searched all over the web and this site to understand how to get the artwork of the current iTunes track. any suggestion? thanks
Asked
Active
Viewed 629 times
1 Answers
2
You can generate iTunes.h using the following command:
sdef /Applications/iTunes.app | sdp -fh --basename iTunes
You can then use iTunes
to get the current playing track:
#import "iTunes.h"
iTunesApplication *app = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
iTunesTrack *currentTrack = app.currentTrack;
Then get the album artwork for the current track:
SBElementArray *artworks = [currentTrack artworks];
iTunesArtwork *artwork = artworks[0];

Nathan Villaescusa
- 17,331
- 4
- 53
- 56
-
That's weird. Here is a copy I found on github: https://github.com/TooTallNate/node-iTunes/blob/master/src/iTunes.h – Nathan Villaescusa Nov 09 '12 at 02:13
-
I found the solution. I need to use `xcrun sdef in Mountain Lion. Thanks a lot! – Luca Nov 09 '12 at 02:17
-
I' ve another problem. the terminal command creates the "iTunes.h" file and then I' ve imported it in my project but after that I can't compile with success. The error is:Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_SBApplication", referenced from: objc-class-ref in PanelController.o – Luca Nov 09 '12 at 02:30
-
Maybe http://stackoverflow.com/questions/9333551/weird-error-with-apple-script-bridge-itunes will help – Nathan Villaescusa Nov 09 '12 at 02:32
-
Yes! sorry about that! Thanks! – Luca Nov 09 '12 at 02:37