How to get the Artwork of the current track in iTunes using Swift/ScriptingBridge?

205 Views Asked by At

I'm currently trying my hardest but can't get anywhere. I can get the current track using iTunes.currentTrack but the .artworks() SBElementArray doesn't really get me anywhere since I don't know what to do with it. There is also @objc public protocol iTunesArtwork: iTunesItem { but I don't know how to get there either. Any help would be appreciated. Thanks!

1

There are 1 best solutions below

0
SilverWolf On

You can get the raw data out of one of the items and make an NSImage out of it. This is Objective-C, but it should directly translate over.

[[NSImage alloc] initWithData:[[[currentTrack artworks] firstObject] rawData]];