Question

Part of my application's functionality is that it gets the currently playing iTunes track's album art (using Scripting Bridge). I'm able to do this fine. However, when a track isn't playing, I'd like to get the default album art that both iTunes and Finder have. Is this possible from code? (or if not, how else?)

Dark square with blue-grey music note

Was it helpful?

Solution

fI'm not sure where iTunes gets it, but I believe Finder gets it indirectly, by asking QuickLook for a thumbnail for the file.

So, the right answer is probably to do the same thing. Either instead of getting album art manually, or as a fallback if that fails, get and display a QuickLook thumbnail.

However, if you want something quick and dirty, you can always read the resource named "Generic Artwork 512" of type "png" out of the QuickLook.framework bundle. For a little extra protection against Apple moving things around in the future, you can make sure QuickLook is loaded, then look for the resource in any open bundle, but you'll still need to watch each new OS release carefully.

You could also draw your own very similar image—this isn't really a UI component, so you're not confusing the user by drawing non-standard UI components—but that won't look ideal. And of course you could hope that the image is simple and generic enough that you can legitimately copy it into your own app, but only if you've got good lawyers to reassure you that this isn't as stupid an idea as it sounds.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top