iTunes metadata and artwork

I had archived a number of things you helped me out with. (turingtest2). One was "exportimport" script. I tried clicking the link in an old posting and it comes up with a 404 error. Is there a way that could be reposted here?


Also had help in trying to maintain the metadata and album art when replacing files in itunes. I got a few different scripts ( Create Folder Art, Update Tag Info, Sort Date Added and then a few different Date Arranger scripts). I had instructions on the order of how to make sure the album art stays on the file but my notes appear to be incomplete as I don't recall the order/steps necessary for that. I believe it was the create folder art script but the sequence of that is what I've forgotten.


I know itunes is not viable much these days but what I am trying to do is replace all the existing titles in my library that are mp3 160 baud with either 320, or even wav, AIFF or FLAC (perhaps AAC).


It seems no matter what I do, I cannot get it to work properly despite all the wonderful guidance you provided. So here's the gist of what I'm attempting.


  1. Use the newer, high quality versions of the same song for all the songs in the library.
  2. Keep all the same information already on the file. This includes the rating, genre, album art, comments, composer, etc. All the metadata that's on the original file.


So each song will just be the newer, better quality version. My plan is to use AIFF or FLAC files as technology seems to be improved to handle these. But if AAC Apple Lossless is the better option, I can do that. But I do want the best possible quality as space is no issue these days (hard-drives).


Any help would be greatly appreciated.

Posted on Aug 27, 2020 1:15 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 1, 2020 3:49 PM

Hi,


I've updated ExportImport to capture artwork. This is the easier tweak. When running in export mode an image is created for each unique album and saved in same folder as the script in the form <Artist> - <Album>.jpg and another line is added to the exported information for that track. In the import phase the current file is checked to see it it has art, and if not, and if there is an image at the saved path, then it is inserted. As a test I used the script to export data for 27 tracks from three albums. I then removed the artwork and used the import mode to restore the artwork.


So step by step:


  1. Select some tracks that you want to upgrade in iTunes.
  2. Run the ExportImport script.
  3. Replace the low resolution files with your higher rate conversions, in the same file format, and at the same paths.
  4. Drag and drop the Export Import [<Date> <Time>].txt file that was created onto the ExportImport script.
  5. Review the updated files in the library and Explorer to check that all the properties have been restored, artwork embedded, etc.


After reviewing the code for the script I've seen how you can use it to upgrade, for example, mp3 to Apple Lossless. Step 3.1 would be to edit the exported data file in a text editor and perform a search and replace operation to change .mp3 to .m4a before saving the file. As long as you've removed the .mp3 files the script will attempt to relink iTunes to the path specified in the text file.


I should be able to add in something more elegant during the import phase that checks for the existence of a file at the location noted during export of <path>.ext and, if it isn't there, looks to see if there is a file with another valid extension from the list <path>.aif, <path>.mp3, <path>.m4a, <path>.wav, etc. If a potential match is found the script can then relink iTunes to that file before restoring the other properties.


tt2

Similar questions

352 replies

Aug 30, 2020 10:56 AM in response to turingtest2

I'm not going to re-rip the CDs. I've already ripped those to wav when I initially burned all my music over the many years. I did that as I anticipated that I would be looking at updating the library with higher than 160 baud rate at some point down the road (which is now). The reason I only did 160 originally was due to the space limitations on the iPods. So what I'll do is convert the wav to AIFF or AAC or MP3 (any suggestions on which is better?), while still saving the original wav.


I just tested the CreateFolderArt script again. Here's what I did:


  1. I converted the same song to a higher baud rate - that file is in a different folder unrelated to the original.
  2. I then highlighted the song in i-Tunes
  3. I ran your script. It asked Yes or No. I chose No.
  4. I then moved the song out of the folder it was in and moved to a different unrelated folder.
  5. I then moved the new one into the folder the original occupied.
  6. I highlighted the song in i-Tunes
  7. I reran your script. I chose No when asked.


All the metadata was there - and the album art was as well. And this is positively the new, updated baud file. (original was 160, I replaced with 320).

The only thing missing was the Lyrics. Could your script somehow be updated to include lyrics? If not, that is totally fine. I have very few files honestly that have lyrics so if those lyrics are lost, that's okay.


What is the Yes mean? Is that telling the scrip to find something in iTunes store to download? Is there a time when I would want to choose Yes?


BTW, I'm still working in iTunes 10.7 because I hate the later versions. I suppose I should update now as part of all this? Your scripts will still work in the latest/last version of iTunes I assume?


Now as it relates back to the CreateFolderArt (CFA) script and the success I had today in running it, I will have to do songs one at a time for those songs that are the "one-hit wonder" variety, or might be split up in different folders. I'm in the radio business and have hundreds of radio-only broadcast disc libraries. For example, in the 500 series, disc 501, there are songs from Three Dog Night, Bob Dylan, Chicago, Doobie Brothers, The Doors, ELO, Elton John, etc. So those songs are from the various albums from each artist. So rather than burning the CD which had all these songs by album - e.g. "Elton John - Honky Chateau" - I added the songs from each disc and then any missing ones not included on the disc libraries, I would then burn from the album.


I'll convert the wav files for each of these discs from each series to the new baud rate/type. But I'm wondering if there's any manageable way that you can think of to make this process easier? Meaning, an album by Elton John mentioned above is scattered in a variety of different folders (some burned from the album itself that I have that wasn't on the radio-only discs). If I could sort my library by file location, that would perhaps make it easier as I could just highlight each folder group and do en mass but I don't see a field for file location on the column choices in iTunes. I know when you export the library that does show so perhaps there's a way to do it by exporting and then importing it back somehow but making it ordered (though I don't know if the sort order from an excel file carries over back into iTunes if you follow).


What I'm going to do with the new library is put all the artists in the proper folder. Once I have all the new baud rate with the included metadata, I'm going to then starting moving to folders by Artist, Album. Then iTunes will need to find them in the new location (could that be another script?) But I planned to do that after I updated the baud rate so that part is done as I said.


Because of the immense amount of work it took to enter the data into each song (that was charted in Billboard), I'd hate to have to redo those one-by-one. I have contemplated just exporting the library, then rebuilding it so all the artists/albums are in their own folder and not have this scattered about. I have so many folders where different music is - including some that are in the Music/iTunes/iTunes Music folder. on C: I did it this way to keep it straight in my mind what each represents.


You're obviously brilliant with this stuff so I'm hoping you have some suggestions.


So sorry to ask but what does the ImportExport script do again? I read your overview but I don't think I need that do I?


A side note: How does the iTunes media folder location work? I've always wondered that. I set it to a hard-drive outside of MyMusic/iTunes on the C: drive. So any tracks I happen to burn off CD will go in that folder and sub-folders (per artist). Is there any constraints or things I should concern myself with there?


I'm sorry to throw all of this at you. Thank you deeply for your replies. You're amazing! Thanks so much.

Aug 31, 2020 5:54 PM in response to William Richards3

I guess I even more confused than ever. Here are the descriptions of the two scripts:


  • CreateFolderArt - Creates or updates Folder.jpg artwork images. If updating images then if at least one track has art it will be embedded in any tracks from the same album that are missing artwork or only have store downloaded art.


  • ExportImport - Exports or imports selected metadata. Can be used to attempt to restore data such as ratings, playcounts, genres, or other corrupted metadata from a previous iTunes library file. To export data first restore or connect to an older library file, select the tracks of interest, then run the script to export. N.b. You may need to temporarily rename the iTunes Media folder during the export phase so that iTunes cannot read the current tags of the files if your aim is to retrieve earlier versions of that information. The output file ExportImport [<Date>] [<Time>].txt is placed in the same folder as the script. Next restore the name of the media folder if you had changed it earlier, then restore or reconnect to the current database and drag & drop the output file onto the script to import. The current version of the script is set to export most, but not all, user editable fields and could be edited to bring forward other data if required. You can comment out lines for fields that don't need to be exported to speed things up a little or to avoid updating fields that you don't want to be changed.


I don't recall folding in any of the features of ExportImport into CreateFolderArt. If you replace a 160k mp3 file with a freshly minted 320k mp3 generated by converting an original wav file it will have an empty tag. Aha, perhaps some realization dawns! If there is no tag at all, rather than a tag with explicitly empty values, then that might be why you don't notice a change. iTunes is showing you all of the information it knows, and perhaps playing a track doesn't cause it to lose any details because it is behaving the same way that it does with wav files. It knows the metadata, which it can use, but nothing is embedded in the track, which is what you would normally want so the files work elsewhere. I don't think CreateFolderArt has been bringing anything to the party. If it has then it has been a happy accident rather than anything intentional. Presumably if iTunes has to create a tag in which to place embedded artwork it then also stores any other metadata that had been living only in the database.


Expose music related fields in Windows Explorer and see what information is stored for the old files before you replace them, then what data is visible in Explorer immediately after you replace with the new conversions, then look once again after running the CreateFolderArtwork script. I think you'll see the data is restored after running the script, which is what you want, but that certainly isn't what the script was designed to do. I'm guessing that might also explain the issue with lyrics if these are only ever stored in the tags, and referenced on demand from there when needed. If that is the case then this accidental metadata preservation method wouldn't work.


In a normal layout each album would be in a single folder, and all tracks for that album would be in that folder. Back in Windows XP if you wanted the folder to show the album artwork you had to store the image as Folder.jpg in the same folder as the tracks., which is the task the script was created for. If tracks from multiple albums are in the same folder, and processed by the script at the same time, then the first pass of the script may repeatedly update Folder.jpg with successive images for different albums, and the second pass may apply whatever image was saved last to all tracks whatever album they come from. This won't be what you want to happen. If you only work with tracks from one album at a time it isn't so much of a problem, although if those tracks are in different folders then the script might not achieve another of its objectives of ensuring that each track from the same album has exactly the same image embedded in the tag. It used to bug me when I'd see a subtle, or sometimes not so subtle, change of image as I was playing an album.


I shall think on about how to allow bulk processing when tracks from an album might be scattered through different folders. I've had a look and ExportImport already allows for lyrics to be archived and restored so I would suggest you test it on a few tracks to see how well it works for you.


tt2

Sep 1, 2020 10:14 AM in response to William Richards3

The first error path looks very odd. I can't think why the CreateFolderArt script would be trying to save there, it is an invalid path. The second one looks more sensible, assuming that folder exists. If it doesn't then clearly in both cases the error is because the file cannot be created at that location.


You used the ExportImport script in export mode twice in succession. The second export would have been the new conversion without the preserved lyrics. Try again with a single track in 160k, export, replace track, drag & drop the exported file onto ExportImport to restore the lyrics.


tt2

Sep 1, 2020 1:02 PM in response to William Richards3

William Richards3 wrote:

And a note on Plex as you likely know, they require this Artist/album kind of structure for that to all work. So while the songs play fine, they're a hodgepodge of wrong album art and not all the songs come in when I tie in the itunes plug-in or try to import playlists.


Again I think is where having the correct metadata in the files is going to help you.


Any thoughts you might have on how to make Plex - or Synology (which is another consideration) - work would be appreciated but that's likely outside this forum as this is Apple specific I guess (?).

Thanks again!


Sep 4, 2020 8:22 AM in response to William Richards3

Hi,


I've updated ExportImport again. The new version should be able to relink the entry in your library to an updated file that is in a different format as long as the replacement file is in the same folder, and just has a different file extension. The process below also works if you, for example, replace a 160k mp3 with a 320k version.


To test it I first used the script to export metadata and artwork for a sample track. I then used iTunes to create a copy of that track in Apple Lossless format, edited or removed most of the metadata from the ALAC version, including the artwork and the lyrics. I then removed the ALAC copy from the library without deleting the file, and moved the original .mp3 to a new folder to break the link to the library. Next I ran the ExportImport script in import mode by dragging and dropping the exported metadata file onto the script. The script connected the now-broken entry in the library that was pointed at the missing .mp3 file to the new .m4a ALAC replacement, and restored the correct metadata including artwork image and lyrics.


Initial .mp3 version:


Running ExportImport:



Apple Lossless version with edited metadata to simulate a fresh conversion from a .wav original. Note I'm not using the iTunes features to keep the media folder organized, so changing properties here doesn't change the filename or location:


Running ExportImport in import mode:



And the library now has an Apple Lossless version instead of the mp3 copy, with all of the same metadata:



Let us see if this new version of the script lets you do the task we started out with. I'm pretty sure it will. I'll discuss artwork clean up in the file system, the minutiae of the iTunes artwork cache, and WMPs side effects in another post.


tt2

Sep 4, 2020 3:07 PM in response to William Richards3

Artwork files - 1 of 2


Back in the day Windows had Windows Media Player. Even if you never actively used it it was possible for it to fire up in the background in response to media on the web. Given half a chance WMP would attempt to scan your user's music folder for any music files to add to its library. WMP might then embed any relevant artwork it could find and the folder would also gain hidden artwork images in the form AlbumArt_{<GUID>}_Large.jpg and AlbumArt_{<GUID>}_Small.jpg for each album that WMP saw as distinct. I.e. there could be more than one set of seemingly identical images for tracks from the same album. The folder would also get a Folder.jpg and AlbumArtSmall.jpg image to be used as the thumbnail for the folder when viewed in Window Explorer. You might also find Desktop.ini and Thumbs.db files. Once created these hidden files will be copied whenever the folder is copied from one place to another, and since they are hidden most people have no reason to become aware of them.


iTunes doesn't make any use of Folder.jpg images or other artwork stored in the same folder as a track. If the file has a tag with embedded artwork then iTunes will use that, otherwise if you're signed into the iTunes Store and have given it permission iTunes will attempt to locate the track in the iTunes Store and if found it will download the associated artwork. This doesn't get automatically embedded in the tag. Instead is stored only in the Album Artwork cache in the form of a .itc2 file, which is a custom container that can hold images in different formats. Again there is the use of a GUID (globally unique identifier) to reference each image and the cache is set out in something akin to a database structure called a hash table. The idea is that iTunes can quickly locate the correct image for a track based on its GUID, or determine that no image exists, and these are all read from the cache as you scroll through the library rather than being extracted on demand from the tag of each track as you scroll through the library.


Other media players such as Plex will generally work with embedded artwork but may also have their own lookup services that try to fetch missing or additional metadata for your media. Looking at Plex's advanced options for managing its music library I see that you can optionally choose to prefer local metadata over anything that its service would otherwise track down, presumably by analysing the file name. There is also a hint there that it might try to make use of locally stored images, but I haven't worked out exactly how it does so.


Your music will work best across a range of applications and devices if its metadata is complete and consistent, with related content stored in a well structured manner. CreateFolderArt was created as one of a number of tools to help me with this task, however it assumes that files are in an iTunes-like layout, with only one album to a folder. Using it in any other context can have unexpected results. The new ExportImport script will do a better job of preserving and restoring the right image for each track as you upgrade them from 160k .mp3 to your chosen format.


tt2

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

iTunes metadata and artwork

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.