Bugzilla – Bug 4180
Support for iTunes 7 downloaded artwork
Last modified: 2009-10-20 14:24:27 UTC
iTunes 7 has a new feature to download missing album artwork from the iTunes Music store. This downloaded artwork is stored in a central folder as ".itc" files! Please enhance SlimServer to pick up this new artwork repository. Notes: I think the folder is <iTunes Music Dir>/Album Artwork .itc files are believed to be "492 bytes of header data followed by a JPEG image" More information here http://blog.skuldtek.com/2006/09/16/albumartworkxtractor-extract-album-artwork-from-itunes-7/
There are some reports that the image can be a PNG instead of a JPEG, but still after the 492 byte header.
cc'ing Dean. This seems like a good idea if it really is that simple. I'll take an action to chop up some iTunes images and see if they really are jpgs and pngs. note to self: dd if=infile of=outfile bs=1 skip=492
It does appear that the image can be extracted easily, problem is that the ID associated with the image is different than that of the song. Some additional inspection is needed.
Found this on Doug's Applescript site: An artwork file in this folder is named so that it looks something like FF83764465D7B232-8ACA10CCDFF3572A.itc The first number is the Library Persistent ID from the XML file and the second number is the track's Persistent ID
alas, the id's from artwork downloaded from the itunes music store are not the same as the unique ids for the tracks. it's going to be a little more work...
Anyone know how to view the images in windows? I checked some files with the expected names exist but couldn't see what's in them!
There's a pretty good analysis of the .itc file structure here: http://www.falsecognate.org/2007/01/deciphering_the_itunes_itc_fil.php I found a tool 'bitmaprip' for Windows that can extract the image files from the .itc, but armed with this I still cannot work out the naming convention for art that's downloaded! Local artwork files are easier.
Once this ID issue is cracked, I'd love to see this added.
Windows only solution: http://cyberrazor.com/2006/07/06/scripting-itunes-with-perl-part-1/
My iTunesUpdate plugin already gets the artwork for played tracks using OLE on Windows, but it's not practical to do it for all files - for a start you're creating a copy of the artwork, not reusing the existing one.
> My iTunesUpdate plugin already gets the artwork for played tracks using OLE on > Windows, but it's not practical to do it for all files - for a start you're > creating a copy of the artwork, not reusing the existing one. We're already pre-caching copies of all artwork files in the common sizes used on the Controller and Default skin. Thus the fact that we'd be copying the data wouldn't matter that much. What bothers me more is that it's a Windows only solution.
(In reply to comment #8) > Once this ID issue is cracked, I'd love to see this added. I took a solid swing at this yesterday, and the problem needs to be solved by Apple. 1) For iTunes Store tracks, it appears that the artwork ID is the same as the first track ID in the album. 2) For all other artwork, the artwork ID is unrelated to the track -- it's largely related to when it was added. Sometimes this results in artwork IDs that are close to the track IDs in the album (since persistent IDs are allocated sequentially), if the artwork was downloaded when the album was added. But that's not reliable. For example, if you delete your Album Artwork folder and re-download all your album covers, the new ones will all be new, sequential IDs. If you then immediately added a new album, its track persistent IDs would follow in sequence (with a few gaps here and there). 3) The link between the album and the artwork ID is buried inside the iTunes Library file. This is a large, undocumented binary blob subject to change. 4) Leopard's QuickLook previews and icons don't even know the format of the iTunes Library file. They're able to display the album artwork for music files by using the iTunesAccess private framework. There are (undocumented) functions called "ITAccessCopyArtwork" and "ITAccessCopyArtworkURL" that QuickLook apparently uses to get the artwork for a given music file. Even if these were stable, public routines, they'd be Mac-only. Getting SC to understand the .itc files is trivial. It's finding the right one that's the problem.
(In reply to comment #12) > I took a solid swing at this yesterday, and the problem needs to be solved by > Apple. Duh, I forgot to say how Apple can solve this. People should submit feedback asking Apple to add <album> objects to the XML file, that include at least the persistent ID of the artwork. <http://www.apple.com/feedback/itunesapp.html> Maybe if they get enough requests they'll add it.
Please add me to list.. Having the same issues
Created attachment 3410 [details] Delphi code for automating iTunes to extract its own proprietary artwork
IMHO the easiest way to get artwork out of Apple's proprieatry .itc files is to let iTunes do it for you. You can create a COM interface on iTunes and command it to give you the respective graphic. See the following function in the (Delphi) code that I just uploaded. function iTunesGetArtWork(anAlbum, anArtist, aTitle: widestring; aTrackNumber: integer): TGraphic; Obviously prerequisites are 1) Windows (for COM), and 2) iTunes installed on the server.
Dan notes tech support gets a LOT of requests for this functionality.
And one of the reasons tech support is getting a lot of requests for the functionality is because users, like myself, will not buy a controller until this is implemented. Simple as that. And I know I'm not the only consumer that feels this way. Rob
Please contact Apple too. If they used a standard, or at least documented format, we would all be happier. Even with the methods known so far (COM on Windows, Applescript on OSX) it's only possible if SC is run on the same machine as iTunes. This wouldn't even help with those popular cases where people store their music on some server, but run iTunes on a client they shut down at night. Dean - should we still investigate in these interfaces? They're not platform independant and need iTunes to work. But it might still be better than nothing :-(.
Apple essentially uses a form of DRM to make the cover art unavailable to any program but iTunes. These scripts are, as you say, better than nothing. I'm concerned that since they are unsupported by Apple, they will be fragile, but I think that they are worth investigating. I suggest that they get added as plugins that are invoked during the cover art scan.
IMO this is a won't-fix bug until someone discovers how to link downloaded artwork IDs to the IDs in the iTunes XML file.
As I said before, let iTunes do the work for you: iTunes has a perfectly safe and well documented COM automation interface to do this. See below. People seem to be worried about the fact that the solution is "Windows Only" -- this is indeed true, but presumably 99% of your customers have Windows O/S on their machines (no?) function iTunesGetArtWork(anAlbum, anArtist, aTitle: widestring; aTrackNumber: integer): TGraphic; { Use iTunes COM automation interface to retrieve album artwork Status: } var iTunesApplication: OleVariant; artwork: OleVariant; artworkList: OleVariant; track: OleVariant; trackList: OleVariant; playList: OleVariant; i: integer; j: integer; graphicType: integer; fileName: string; const extensions: array[0..3] of string = ('unk', 'jpg', 'png', 'bmp'); begin Result := nil; try // try to open a COM interface on iTunes iTunesApplication := CreateComObject(CLASS_iTunesApp) as IiTunes; except // on error just exit on Exception do exit; end; try try // get iTunes master playlist playList := iTunesApplication.LibraryPlaylist; // create a list of all tracks having the given track title (song name) trackList := playList.Search(aTitle, ITPlaylistSearchFieldSongNames); // process all (duplicate) tracks for i := 1 to trackList.Count do begin track := trackList.Item[i]; // apply a more stringent check to eliminate false duplicate matches if (track.Kind = ITTrackKindFile) and (track.Album = anAlbum) and (track.Artist = anArtist) and (track.TrackNumber = aTrackNumber) then begin artworkList := track.Artwork; // iTunes can have more than one image, so process them all for j := 1 to artworkList.Count do begin artwork := artworkList.Item[j]; // determine the graphic type graphicType := artwork.Format; // create a graphic object if graphicType = ITArtworkFormatJPEG then Result := TJPEGImage.Create; if graphicType = ITArtworkFormatPNG then Result := TPNGGraphic.Create; if graphicType = ITArtworkFormatBMP then Result := Graphics.TBitmap.Create; if Result <> nil then begin // generate a temporary file name fileName := GetTempFile(extensions[graphicType]); try // ask iTunes to save the graphic to the temporary file artwork.SaveArtworkToFile(fileName); // load our own graphic object from the same temporary file Result.LoadFromFile(fileName); finally // delete the temporary file SysUtils.DeleteFile(fileName); end; // we got one graphic; this is enough break; end; end; end; end; except // swallow all exceptions on Exception do ; end; finally // don't leave iTunes open iTunesApplication.Quit; end; end;
SC is cross-platform. Using COM is the wrong solution, sorry.
COM is fine for Windows. AppleScript is fine for OSX. Two solutions already, and we'll still (or even more!) hear complaints from the users who're running SC on a NAS. It's not as simple as this. We need a cross-platform solution.
Having the artwork scanner able to get at iTunes cover art when running on Windows and Mac is a good thing, assuming that it works reliably. These are, after all, the only platforms that iTunes runs on.
> Having the artwork scanner able to get at iTunes cover art when running on > Windows and Mac is a good thing, assuming that it works reliably. These are, > after all, the only platforms that iTunes runs on. It seems to be pretty common to store the .xml file on a NAS and have SC scan it on the NAS.
Ok guys, it is fine with me if you decide not to use Windows COM. Just let me know when you finally flag this bug as "won't fix, too difficult" and then I will write (and donate) a little Windows application that uses iTunes to read in cover art from the iTunes proprietary location, and stream it back into the "covr" box inside the respective M4A files, so that your scanner can find it. This will probably only take me a couple of hours to write, but (on principle) I won't do it until you formally admit defeat doing it "your" way ;-)
Is anyone from Slim Devices currently working on a solution to this issue? I have been told (numerous times) by Customer Service that this issue has been given top priority. However, the lack of activity listed here leads me to believe that this isn't the case......
Nope, I hit a wall because there is no way I could find to link an iTunes artwork file to the track or album it belongs to. If you know of one, I'd be happy to work on it.
(In reply to comment #30) > Nope, I hit a wall because there is no way I could find to link an iTunes > artwork file to the track or album it belongs to. If you know of one, I'd be > happy to work on it. It has been mentioned before: there IS a way to extract iTunes artwork from files. You can do it easily with the COM interface on the iTunes application (on Windows PCs) and apparently also with the AppleScript interface on iTunes (on Apples) -- although admittedly I don't have a Mac so I have not tested latter. Clear: these two solutions will not run on Unix / Linux machines etc. So the solution is platform specific. Then again, people who have the problem with iTunes art are, by definition, people who run iTunes itself. So the problem is platform also specific. IMHO if you have a platform specific problem, then a platform specific solution is quite OK, so I don't understand why you insist on being so holy about having a platform independent solution...
This is a big issue for our customers. Let's look into adding the COM and Applescript support for this in 7.3.
(In reply to comment #32) > This is a big issue for our customers. Let's look into adding the COM and > Applescript support for this in 7.3. FYI -- I just "upgraded" a few albums and singles through iTunes Plus (removal of DRM and improved to 256K sound). On those albums, the artwork now shows on the controller and in SC. May be worth investigating.
The artwork is embedded in the file, and since it's DRM-free, we can easily extract it.
As a non-techie who registered an interest in this bug, what am I supposed to do re executing the chunk of Delphi code?
As previously promised, I created a small Windows application that automates iTunes (via its COM automation interfaces) to copy the downloaded artwork from the iTunes proprietary folder and embed it directly in the MP4 (M4A) files themselves. Since the latter embedded art is encoded in a non proprieatary way, this tool enables the SqueezeCenter scanner to find and extract the artwork images from the music files in the normal way. You can download it here: http://www.whitebear.ch/music#iTunesArtFixer (look for iTunesArtFixer) Also my M4A Windows Explorer shell extension is here: http://www.whitebear.ch/music The iTunesArtFixer application requires iTunes to be installed on your PC, and it runs on Windows Vista and XP. AndrewFG
I tried to use a simple AppleScript to see if I could get at the downloaded artwork. But I can't even get this to work (iTunes 8.0.1). tell application "iTunes" repeat with aTrack in tracks of library playlist 1 repeat with anArtwork in artworks of aTrack if downloaded of anArtwork is true then set theData to data of anArtwork end if end repeat end repeat end tell It crashes on the "if downloaded..." line with "Exception: iTunes got an error: File some object wasn’t found." Can anyone help?
OK, I managed to get it to work, this script will show the names of all tracks which have downloaded artwork. Getting somewhere at least... :) tell application "iTunes" set totalCount to count of every track of library playlist 1 set trackCount to 1 repeat while trackCount ≤ totalCount try set theArtwork to artwork 1 of track trackCount of library playlist 1 if downloaded of theArtwork is true then log (name of track trackCount) as string end if end try set trackCount to trackCount + 1 end repeat end tell
Your code looks on track to me. I don't know Apple Script but here is the code in Delphi for the Windows COM ActiveX interface... // get iTunes master playlist playList := iTunesApplication.LibraryPlaylist; // get the list of all tracksin the playlist trackList := playList.Tracks; // process all tracks for i := 1 to trackList.Count do begin track := trackList.Item[i]; artworkList := track.Artwork; // iTunes can have more than one image for j := 1 to artworkList.Count do begin artwork := artworkList.Item[j]; if artwork.IsDownloadedArtwork then begin // determine the graphic type graphicType := artwork.Format; // generate a temporary file name fileName := GetTempFile(extensions[graphicType]); // ask iTunes to save the graphic to the temporary file artwork.SaveArtworkToFile(fileName); end; end; end;
Thanks, I'll see about porting that to Win32::OLE after I get the Mac version working with AppleScript.
I already wrote the Win32:OLE perl code to do this in my iTunesUpdate plugin. http://www.jamescraig.co.uk/SlimServer
Even better, thanks. :)
Change 23441 - AppleScript to dump all downloaded artwork to a folder. Next steps: Win32 version Integration with the scanner
This should now be working on Mac, please test! There are still some loose ends to tie up and I still need to add support for manually-added images in iTunes, but it works great for me with downloaded artwork.
For Mac, should we use the script you wrote in Comment #39? (In reply to comment #44)
(In reply to comment #45) > For Mac, should we use the script you wrote in Comment #39? (In reply to > comment #44) > sorry, I meant comment #38.
No, you should just use 7.3.
Just wanted to note that mov123 is broken in 7.3 right now so those users that play AAC files might want to hold off. See bug 9638.
Should now be working in 7.3 for both Windows and Mac. Needs lots of testing!
SqueezeCenter 7.3.0 23961 appears to now support iTunes album art. Tested under Vista / XP / OSX 10/5 - with iTunes 8.0.1 (11) Please reopen and add comments if needed
This bug has been fixed in the 7.3.0 release version of SqueezeCenter! Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already. If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
I have the following problem: I am running OSX 10.5.5, Squeezecenter 7.3, iTunes 8.02. and the artwork was imported from iTunes, unfortunately when you select an album, for example, the artwork is displayed for the album and the first track. Tracks 2 through X are the gray quarter note. Almost fixed, but no cigar as far as I can determine. If there is a fix for this, please let me know. Thanks, Rob Stone
Rob, did you try a "Clear library and rescan everything" after the initial scan? If you did is the artwork still missing? This behavior sounds familiar and might be a different bug.
From customer email: I don't believe I did a "Clear Library". I will do this and report back. To be clear, I am seeing album art in both the Artist and Album categores. Problem is when the Album/Artist is selected, in the player section of slimserver, the album art is displayed in the "album" and also displayed in track one. In track two to track X there is no album art displayed. Rob
iTunes stores artwork on a per-track basis, and I believe for some reason sometimes all tracks in an album don't have associated artwork.
(In reply to comment #55) > iTunes stores artwork on a per-track basis, and I believe for some reason > sometimes all tracks in an album don't have associated artwork. Indeed. iTunes track files (.M4A extension) are encoded according to the MP4 industry standard; each .M4A file may contain zero or more "COVR" boxes containing a JPEG, PNG or BMP encoded image. In iTunes, the proper way of embedding artwork in an album is to select ALL tracks in the album and then Ctrl+I (get information) and then paste the artwork into all selected tracks. The "improper" way is to select just the FIRST track in an album and then Ctrl+I and paste; this stores the artwork into the first M4A track only, and this is sufficient to keep iTunes happy, but apparently it is not sufficient for SlimServer's Scanner One solution would be to script iTunes to pre-process the artwork in its playlist, (by means of the following pseudo code), before you get Scanner.exe to do its normal business: currentAlbumName = '' for each Track in iTunes.LibraryPlaylist do { if Track.Album = currentAlbumName then { if FileExists(tempArtworkFileName) then { Track.Artwork.SetArtworkFromFile(tempArtworkFileName) } } else { currentAlbumName = Track.Album DeleteFile(tempArtworkFileName) if Track.Artwork.Count > 0 then { Track.Artwork.Items[0].SaveArtworkToFile(tempArtworkFileName) } } } DeleteFile(tempArtworkFileName)
Ticket 081222-003755 OS: Windows Vista Itunes 8.0.0.2 SqueezeCenter 7.3 and 7.3.1 This issue seems to be with playlists displaying all Artwork. Symptom: -The problem is that although all the artwork is present on the left pane (Listing of Albums by Artist), on the right pane there are many pieces of artwork that are missing. -Not all Itunes Artwork is showing in SqueezeCenter 7.3.1 (latest official release) -Artwork for some songs on an album but often not for all of them. -Albums have Artwork (left pane in SqueezeCenter 7.3.1) -Songs from the same album are not tagged with this Artwork, show up as empty when seen in a playlist (right pane of SqueezeCenter 7.3.1). What causes artwork to be present for one song in an album and not in others? *************** Troubleshooting: -Performed clean install of SqueezeCenter 7.3.1 -Customer had music folder location on basic settings tab (had remove) -Customer had playlist location under basic settings tab (had remove) -Had check "Use iTunes" under Itunes tab -Had customer clear library and rescan everything just using Itunes Customer states all artwork issues are resolved except for Playlist only showing about 70% of Artwork ***Please See Screenshot Attached********
Created attachment 4507 [details] From Ticket 081222-003755
iTunes stores and we import artwork on a per-track basis. For some reason iTunes does not always link artwork to all tracks. I guess we need some logic to go back and find these tracks with no artwork and use artwork from another track on the same album.
From Ticket #081222-003755 I believe I have solved the problem. It goes something like this: In iTunes, iTunes will display artwork for an album as long as any one song in the album contains Artwork. In fact when iTunes loads artwork on request "Get Album ArtWork (iTunes request)", it populates one song only with the artwork. There is a manual feature within iTunes to force artwork into each song by copying and pasting into them. Of my 6500 songs, only 40% contain imbedded artwork. Squeeze Center must have a similar object for displaying Albums on the left pane. However when I sync SqueezeCenter with iTunes I get a lot of duplicate albums as SqueezeCenter uses a different algorith to identify an album versus iTunes. In iTunes the key is something like Artist and Album Name. In SqueezeCenter it appears to be a combination of Artist, Album Name, Album Artist, Disk Number and Compilation switch. When these are not 100% aligned, this produces duplicate Albums in SquuezeCenter. I went through all my duplicates, fixed them in iTunes and now my songs are all in alignment. This process did not resolve the missing artwork seen in playlists shown on the righ pane of SqueezeCenter. This problem is caused by the first point above. Artwork will only be shown (right pane) if the artwork is contained/embedded in each and every song. This is an exteremly painfull and time consuming process. Do you know of any utility that would perform this tedious task of populating each song in an album (or selection) with the artwork found in one of the songs? In any case all issues are now understood and on their way to being solved. Not sure I have this 100% without seeing how this is coded in your application but based on what I have seen, the logic seems to follow the explanation I have given. Appreciate any help you could provide.....thanks again.....Mason
(In reply to comment #60) > In iTunes, iTunes will display artwork for an album as long as any one song in > the album contains Artwork. In fact when iTunes loads artwork on request "Get > Album ArtWork (iTunes request)", it populates one song only with the artwork. Correct. > There is a manual feature within iTunes to force artwork into each song by > copying and pasting into them. Of my 6500 songs, only 40% contain imbedded > artwork. > Do you know of any utility that would perform this tedious task of populating > each song in an album (or selection) with the artwork found in one of the > songs? Yes !! See the forum post concerning my utility here: http://forums.slimdevices.com/showthread.php?t=53413 Or download it direct from here: http://www.whitebear.ch/music#iTunesArtFixer (look for iTunesArtFixer) And (if you are interested) my Windows Explorer Shell extension is here too... http://www.whitebear.ch/music
(In reply to comment #61) Thanks so much for your utilities. Unfortunately the Windows Explorer Shell only seems to work for .m4p and .m4a files, but 90% of my files are .mp3's as this is the only format that works with car (and other) mp3 players, so almost all of my music is converted to that format. I have not tried your iTuneArtFixer program yet as I actually found another program called iTSfv (iTunes Store file validator. This program is quite useful at looking for and fixing many issues with music libraries and I was able to use it to embed the ArtWork in every .mp3, m4a.... file. Just a question on your iTunesArtFixer, will it show me what needs fixing before it fixes anything? And will it update artwork if it exists? Thanks so much for your help and advice on this issue. I really think the answer is to embed artwork in every file rather than trying to work around missing artwork. I wish iTunes would do this automatically or at least provide a setting for this to occur for users who need this capability. I understand there is a capacity and possibly a small performance hit, but this seems reasonable given the use of these files in so many applications besides iTunes. Thanks....Mason > (In reply to comment #60) > > In iTunes, iTunes will display artwork for an album as long as any one song in > > the album contains Artwork. In fact when iTunes loads artwork on request "Get > > Album ArtWork (iTunes request)", it populates one song only with the artwork. > Correct. > > There is a manual feature within iTunes to force artwork into each song by > > copying and pasting into them. Of my 6500 songs, only 40% contain imbedded > > artwork. > > Do you know of any utility that would perform this tedious task of populating > > each song in an album (or selection) with the artwork found in one of the > > songs? > Yes !! > See the forum post concerning my utility here: > http://forums.slimdevices.com/showthread.php?t=53413 > Or download it direct from here: > http://www.whitebear.ch/music#iTunesArtFixer (look for iTunesArtFixer) > And (if you are interested) my Windows Explorer Shell extension is here too... > http://www.whitebear.ch/music
Customer ripped all his music as apple lossless format. SC can see all album and play music fine. The problem he cannot view artwork at all. RN= 081225-000313
SC 7.3.1
(In reply to comment #62) > Unfortunately the Windows Explorer Shell > only seems to work for .m4p and .m4a files, but 90% of my files are .mp3's The shell extension was written to support MPEG-4 encoded files (e.g Apple .m4a). It was NOT written to support MPEG-3 files... > Just a question on your iTunesArtFixer, will it show me what needs fixing > before it fixes anything? Yes. > And will it update artwork if it exists? No.
(In reply to comment #59) > iTunes stores and we import artwork on a per-track basis. For some reason > iTunes does not always link artwork to all tracks. I guess we need some logic > to go back and find these tracks with no artwork and use artwork from another > track on the same album. Andy, should this new logic be its own bug or perhaps part of bug 9919? Or do you think it should just remain open in this bug?
James: This bug is fine.
We are now planning to make a 7.3.3 release. Please review your bugs (all marked open against 7.3.3) to see if they can be fixed in the next few weeks, or if they should be retargeted for 7.4 or future. Thanks!
Since there's now a planned 7.3.3 release, bugs which won't make the cut-off are being moved to the next target out. If you feel that this bug needs to be addressed more (or less) urgently than the 7.4 release, please cc chris@slimdevices.com and leave a comment in the bug to that effect so we can review it. Thanks.
I would love to see this bug solved in 7.3.3. I think all people which are using itunes to manage their music are having this problem. I don't want to use additional software to store the artwork in each and every track to get a work around for this issue. I hope, that itunes 8 doesn't add trouble to this issue!
For some reason Bugzilla did not change the target when I did this yesterday. Or maybe it was me. In either case, I'm trying it again.
Moving 7.4 bugs to 8.0.
Hi, I believe i'm seeing this issue. With a new radio (and installation of 7.4.0 squeezecenter) which is hooked up to itunes on a mac mini running 10.4, i'm seeing about 1/3 of my artwork not showing up. it appears to be the artwork that's stored in the itunes xml file and the artwork folder that itunes manages. it's hard to tell from the comments in this thread whether this part of the bug is considered fixed. i looked at an mp3 itself, and it has no embedded artwork. would it be helpful to provide (a portion of) the itunes music library.xml file and the scanner.log? Thanks!