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

Oct 8, 2020 1:29 PM in response to turingtest2

Hi,

You'd mentioned before that I didn't have to run the CleanDeadArt against each individual folder so I used it on the drive where it had several music folders. (I used the CleadDeadArtCustom script).


However, after browsing to the drive/main folder (with sub folders) and then making a folder for the artwork to be moved to, I kept getting an error message. I wondered perhaps if it was the fact that I was on a different hard-drive than the script but then that was the case when I last did this clean up. Then I thought I'd try individual folders and that didn't work either.


This is the error message I'm getting:



Any thoughts? The script I'm using is version 1.0.0.13. The same day I also got version 1.0.0.12 from you but the .13 version also removed folder jpeg.

The script is on D drive as you can see and the drive I'm trying to clean is E.


Anyway, please let me know. I must be doing something wrong. THANKS!

Oct 18, 2020 1:38 PM in response to turingtest2

I'm at wits end. I tried doing the export/import followed by customRenamer script a dozen different times. Which meant I had to keep moving songs back to their original folders and trying again. I did get the script 1.0.0.23 (force equals true) once. But even it fell apart upon trying with the next batch of songs.

In a nutshell, this is what I did;

1.     Create playlist

2.     drag titles over than are 160

3.     Don't highlight the songs in the playlist

4.     Run Export/Import script - it creates a .txt file

5.     Now delete the songs from the folders they were in

6.     Highlight the songs on the playlist

7.     Drag new versions into where they were in the 160 folders

8.     Now drag the .txt file onto the export/import script. This may take a little time but it should produce output.

9.     Still highlighting the files in the playlist, run customRenamer script and point to the location the songs will be going.


I was able to get this to work twice I think today (I've lost track). But I've literally been at it for hours just trying to get one album to work. I keep getting error messages and I'm following very specific flows and don't think I'm doing anything wrong. Again, I tried both of your recent scripts.


I also noticed some "ratings" were missing - but that could have been from repeated attempts at making this work. My goodness, this is turned into quite the mess as it's not working as it's supposed to.


When it creates the .txt file, am I supposed to leave the .txt file open? I usually close it and then click OK for the results that are generated. I doubt that makes any matter but I'm just trying to throw it out there to see.


I'm sure it's operator error. I hope you'll have time to reply soon. I'm pretty much stuck at the moment otherwise. Thanks.

Oct 27, 2020 12:07 PM in response to William Richards3

Good news! I think I discovered what the issue was. I kept using the same three songs over and over (I'd move them out and put upgraded files in. I'd run the process and it would throw an error so I put the originals back in after deleting the upgraded files). And those same three songs became my testing ones - which I think was confusing iTunes or the script?


Today, I used 3 different songs and went through the steps and it worked perfectly. I then tested it on a different set of three songs and it also worked. I first tested on .21 or .22 (I forget) and then on .23 and it worked great. I haven't tested on .24 yet, though that's the latest version.


So I think it was all operator error on my part - though it would be good to know why using the same set of songs would be a problem?

I also had gone back to archived ITL and XML files from last Thursday (as that's how long I've been trying to figure this out) so perhaps that also was the difference.


Either way, I'm keeping my fingers crossed that it will work with the thousands I'll be doing shortly.


I had a couple of other things I was awaiting your input on.

YOU SAID: I'll try to rework the code tomorrow to put in some additional checks and perhaps allow it to skip over what would otherwise cause an error. This was related to the CleanDeadArt script which you said could be run on more than one folder at a time. That's not a huge priority, but if you could, that would be great.


I also had asked about why, when I replace several songs and I have to have iTunes locate it, and I locate the first song, it asks "do you want itunes to try and find other songs" (or something to that effect), and it never does, it says it can't find any of the songs that aren't linked. That is a concern with the work I'm doing. Do you know what that's the case?


As before, I hope things find you well. I hope to hear from you.


You've been great so thank you for all you've done. Cheers!

Nov 12, 2020 1:59 PM in response to turingtest2

Great to hear from you. Your scripts and help have allowed me to make really good progress. That said, I'm still running into a couple key issues.


  1. The biggest one has to do with the Export/Import and then CustomRenamer process. I actually had some success with this, but it's sporadic and today, coincidentally it didn't work again.
  2. The other has to do with my moving and replacing things where iTunes will not find a file and then I'll click "locate" and find the file in question. But when it asks if I want to find other missing files, it never does. And this means I'm having to do songs one-by-one. See my previous posts above in my last few posts. I'm not sure why iTunes isn't seeing. For example, the one/first song I locate is one of several files that are in the same folder and related to the first.


Getting back to #1 point; here's what I do where I'm running into problems.

  1. I create a playlist
  2. I drag the songs I want to use for custom renamer into the playlist from windows where the songs are.
  3. I highlight the songs in the playlist and run Export/Import. It creates the .txt file.
  4. I then move the songs out. I replace them with the updated ALAC files.
  5. I then drag the .txt onto the Export/Import script.


What's happening is it's getting hung up and throwing the error I posted in my last few posts. Sometimes it will do the first song and then error out. Earlier this afternoon it did about 7-8 with the new ALAC but then crashed and the other 4 or 5 songs were still unchanged.


Here's an example of the error:


I'm not sure but I recall you had said something earlier about using a different folder for export/import but I've tried that. Now, in the past week I used this same flow and it worked fine. So there must be something I'm not doing right. Does the song file (the 160 baud and ALAC) have to be identical with the metadata? I make sure the actual file names are exactly the same.


Unrelated to the above, here's a minor thing you had last said you would look at doing. This had to do with the CleanDeadArt script. Oct 8, 2020 3:49 PM in response to William Richards3


I'll try to rework the code tomorrow to put in some additional checks and perhaps allow it to skip over what would otherwise cause an error.


Again, GREAT to hear back from you. Please let me know. And BTW, I am pretty much ready to update the library as I've spent the past month or so updating my itunes - pruning songs I don't want in there any longer, duplicate titles, album artwork (done by hand) on all missing songs, made sure ratings were applied to each and various things like that.


So please let me know kind sir and thank you for reaching out. It's really good timing because I'm right at the point where I'll be doing tons of this moving out 160 and replacing with Lossless.


Thanks so much!!

Nov 17, 2020 8:00 AM in response to turingtest2

I just happened to notice that the "description" for some songs I've been working on updating and then moving to new location show both locations (though the song Info tab only shows it's new, current location). See how it shows the "O:\MEDIA\MUSIC" drive but then after the song artist-title, it shows the location of where the song was before. Is this normal? That happens on every song I've done in glancing over things.



Anyway, it's probably nothing but I just happened to notice. Thanks.

Dec 9, 2020 2:07 PM in response to William Richards3

William Richards3 wrote:

Hello,
I'm hoping against hope that you'll reply to my posts over the past weeks.


Sorry if I've missed something. The most likely scenario is that I opened a post which I didn't have time to reply to immediately and then I've had a browser restart and lost track of that thread. That said I've also just had about 40+ threads pop-up as unread, some as old as a month, so perhaps something funky is going on with the forums. Currently refusing to let me copy and paste links too. Very odd.


This is a quick one hopefully; I have a folder with songs in it but there is no album name on the files, though they're definitely on them in iTunes. Which script would get them showing up in Windows? The album art is there. And it is just this one folder. Not sure why. They're MP3 songs.


Most likely scenario I can think of is a multiple tags problem as described in Repair security permissions for iTunes for Windows - Apple Community.


tt2

Dec 9, 2020 5:22 PM in response to William Richards3

Here is where it would probably help to stick to one specific issue in a post.


William Richards3 wrote:

Great to hear from you. Your scripts and help have allowed me to make really good progress. That said, I'm still running into a couple key issues.

1. The biggest one has to do with the Export/Import and then CustomRenamer process. I actually had some success with this, but it's sporadic and today, coincidentally it didn't work again.


What didn't work? What tracks were you renaming, with what pattern? What did you expect to happen? What actually happened?


<Edit> Now that I've replied to more of this post I see you've mentioned an issue with ExportImport. I'm not sure CustomRenamer is even involved at this point.


2. The other has to do with my moving and replacing things where iTunes will not find a file and then I'll click "locate" and find the file in question. But when it asks if I want to find other missing files, it never does. And this means I'm having to do songs one-by-one. See my previous posts above in my last few posts. I'm not sure why iTunes isn't seeing. For example, the one/first song I locate is one of several files that are in the same folder and related to the first.


See this post on fixing broken links. Your non-standard layout doesn't help with the iTunes repair mechanism. It is possible my FindTracks script will either do a better job, or could be adapted to do so.


Getting back to #1 point; here's what I do where I'm running into problems.
1. I create a playlist
2. I drag the songs I want to use for custom renamer into the playlist from windows where the songs are.
3. I highlight the songs in the playlist and run Export/Import. It creates the .txt file.
4. I then move the songs out. I replace them with the updated ALAC files.
5. I then drag the .txt onto the Export/Import script.

What's happening is it's getting hung up and throwing the error I posted in my last few posts. Sometimes it will do the first song and then error out. Earlier this afternoon it did about 7-8 with the new ALAC but then crashed and the other 4 or 5 songs were still unchanged.

Here's an example of the error:

https://discussions.apple.com/content/attachment/af27986e-70db-4261-9435-ca0202d60870


In my version of ExportImport line 518 reads End If. It is an unlikely to cause an error. Visually the code appears to be balanced as far as Ifs and End Ifs goes. Is it the same in your version of the script? Do you recall what edits were made for the update-fix version? I don't seem to have a matching copy here.


I'm not sure but I recall you had said something earlier about using a different folder for export/import but I've tried that. Now, in the past week I used this same flow and it worked fine. So there must be something I'm not doing right. Does the song file (the 160 baud and ALAC) have to be identical with the metadata? I make sure the actual file names are exactly the same.


The file paths need to be identical apart from optionally the file extension. It shouldn't matter if you change format/bitrate/depth etc.


Unrelated to the above, here's a minor thing you had last said you would look at doing. This had to do with the CleanDeadArt script. Oct 8, 2020 3:49 PM in response to William Richards3

I'll try to rework the code tomorrow to put in some additional checks and perhaps allow it to skip over what would otherwise cause an error.


Again, you're going to have to jog my memory here or post an example of where the script causes an error for you.


Again, GREAT to hear back from you. Please let me know. And BTW, I am pretty much ready to update the library as I've spent the past month or so updating my itunes - pruning songs I don't want in there any longer, duplicate titles, album artwork (done by hand) on all missing songs, made sure ratings were applied to each and various things like that.

So please let me know kind sir and thank you for reaching out. It's really good timing because I'm right at the point where I'll be doing tons of this moving out 160 and replacing with Lossless.


Glad to hear you're making progress, and once again my apologies for losing track of this thread.


tt2

Dec 9, 2020 5:48 PM in response to William Richards3

William Richards3 wrote:

Oh, one more quick comment on my challenges with Export/Import flow. It seems to be losing the "ratings" ***** etc. on the metadata for the song(s). But not all of them? I see there's a new version 1.0.0.24 but I don't know if that's your work as the last one you referred me to was .23.


Just tried here setting a bunch of track ratings, exporting the data, changing them, then importing the exported file to restore the ratings that I'd changed. All worked as expected. Since ratings aren't stored in files they really ought to be preserved without any extra effort from ExportImport. Curious.


tt2

Dec 9, 2020 5:52 PM in response to William Richards3

William Richards3 wrote:

Just an update to say I tried this again today. I tried doing the Export/Import on an album/songs that I'd never touched before. Meaning that no other attempts using this script have been done prior to the flow outlined below. I followed the flow I am supposed to and it still throws and error. It seems it's something to do with line 703? I have bolded that line.

If NewFile Or T.Name<>Value Then ' Don't update if value won't change
If NewFile Then T.Name=Value & "*" ' Force iTunes to update tag
Trace T,Change("Name",T.Name,Value)
T.Name=Value
U=U+1
Else
V=V+1
End If
Case "<played>"

And this is the error I just got when trying this today.

https://discussions.apple.com/content/attachment/940d45cb-d7c1-4ffd-8f1f-1b67cf9092711.

I am 99.99% sure I'm doing what I'm supposed to.

I make a playlist and then drag the songs from Windows folder that I'm going to upgrade to lossless.
2. I then run the E/I script 1.0.0.23. This creates a .txt file.
3. Then I move out the songs from the Windows folder (160 baud) to a different folder (though still on the same hard-drive)
4. Then I move the higher quality songs into that folder, replacing the 160 songs that were moved out. I do copy/paste from where the were. (I've tried moving them into the folder where 160 songs were but it doesn't matter).
5. I then take the .txt file and drag it over and drop onto the E/I 1.0.0.23 script

That's when the error occurs so I'm not getting to the next step which would be the customer renamer to move to the new Hard-drive I'm putting everything onto.

(I've tried version .21, .22, and .24 as well without success) (NOTE: It seems that version 1.0.0.17 works well - except it's missing ratings and cover art I believe, which subsequent E/I scripts addressed. So something is happening to keep this from working now versus version .17 (sans missing artwork/ratings metadata I believe). (NOTE: I also think .23 handles a few songs at a time okay maybe(?) but has trouble with many tracks at a time (I'm doing about 15-18 at the moment - not large batches).

So can you figure out what's wrong? Am I missing a step or in the wrong order? As before, this is now stunting my progress for doing the project and finishing this massive undertaking. I'm praying that you'll be able to figure this out. Please let me know. I'm standing by.

Thanks!


The track is not modifiable error suggests either a permissions problem (see Repair security permissions for iTunes for Windows - Apple Community), interference by anti-virus software, or in the case of your newly converted files it could be that the software you're using hasn't closed the files yet. Perhaps you need to close that software and/or temporarily disable your AV or set up some folder exclusions.


tt2

Dec 9, 2020 7:28 PM in response to William Richards3

William Richards3 wrote:

1. Hello kind sir. I didn't do any work the past few days. But I changed the sequence of what I was doing, but it didn't work fully either. Let me explain.

For some reason, I had it in my head that I needed to create a playlist, then drag the songs over from windows I wanted to change our fidelity quality (160 baud for lossless) into the playlist. That has not worked.
2. So today, I thought I would just use the Export/Import script and not worry about creating a playlist. So I highlighted the 10 songs from a Paul Simon album. I did the usual sequence (highlighted the songs, ran the E/I script - 1.0.0.23, and it gave me the .txt file. I then moved the 160 baud songs out of the folder they were in. I copied in the new lossless version. I dragged the .txt file onto the script (1.0.0.23) and it worked, but eventually threw the error I've been getting. I did see that it worked for some of the 10 songs but not all of them. They were all in the same folder as the 160's were so I'm still stuck as I've been now for over 5 weeks.

You can see here that some of the 160 weren't modified, while others were. I have no clue why this isn't working.



https://discussions.apple.com/content/attachment/290b5c1d-3b22-4a58-968f-8ed74e0e6ccc

The 1.0.0.17 script works fine - BUT it doesn't hold artwork or ratings I believe (which is why you continued to tweak it). At this juncture, unless I hopefully hear from you, I either need to go back to the .17 version and then manually update tons of songs, or just give up and figure out a different approach.

I am getting frustrated as I've been at the juncture where all artwork was manually added by hand, the pruning of all the songs has been done, ratings have all been updated for those that didn't have, and many more things I've been working on to now get me to this point. But as I said, I'm stuck unless, or until you can hopefully tell me what I'm doing wrong, or what happened between .17 version and the later versions you tweaked.

Your help has been just incredible and I'm thankful you've helped be greatly to get this far. All I need now is this script fixed, or correct the flow I'm maybe doing wrong.

I stand by hoping to hear from you soon. I really REALLY appreciate all you've done and sincerely pray to hear back quickly. If not, consider this a big huge thank you to get this far.

As always, I deeply appreciate everything you've done. Thanks!


ExportImport can only export the bitrate it reads from iTunes. It doesn't attempt to write that value back. iTunes should recalculate the bitrate based on the format and properties of the audio data as soon as it spots that a track's tag no longer entirely agrees with its internal record. Playing a track may force its hand. I've not paid particular attention to this field, but I can try replicating the upsampling process again here and see what results I get.


OK, just tried replacing some 160k MP3s with some Apple Lossless replacement files. The Bitrate and Kind columns updated as expected during the import phase. Given it seems that you're sometimes seeing the import fail perhaps you're looking at tracks affected by that issue. If you try to play them are they working or broken?


tt2

Dec 9, 2020 8:42 PM in response to William Richards3

William Richards3 wrote:

Hello again. I used the "creating a playlist, and dragging files to it from Windows" process. Then highlighted. Ran the E/I script. Then moved the songs out of the Folders they were in in Windows. Then added the new Lossless tracks. Dragged the .txt file onto the .17 script. It finished but out of 187 tracks, about 10 or so had to be located individually. If I'm doing hundreds of songs at a time as I go along, that's going to be tedious. Why were the files not found?


Offhand I don't know. At this point we're far enough removed from when we started that I can't recall the exact operation. I'd need a specific example of the before and after path for a track that needed to be located individually to work out why, and hopefully improve that mechanism. It could potentially be something not immediately visually obvious like the occasional double space.


They're the same exact 187, just in different format (lossless).
I ran the CustomRenamer and saw a critical error for the first time (that I've seen that). I canceled it and ran again and it went fine.

Anyway, slowly trying to piecemeal this together as I await some important feedback from you hopefully. Little frustrated, though appreciative to get this far. But the scripts seem to be failing in some way as per my recent posts as part of my questions.


Should you see that critical error again a line number would be useful.


tt2

Dec 18, 2020 3:14 PM in response to turingtest2

YOU SAID: In my version of ExportImport line 518 reads End If. It is an unlikely to cause an error. Visually the code appears to be balanced as far as Ifs and End Ifs goes. Is it the same in your version of the script? Do you recall what edits were made for the update-fix version? I don't seem to have a matching copy here.


ME: Per above, I am using 1.0.0.17 script as it's the last working version - though .18 thru .23 or .24 were done to address issues in .17 (I don't recall what those were but I recall you noticed a spelling error (e.g. an apostrophe or something?) or perhaps just a small tweak because something wasn't fully there with metadata or something. So my version that I have been using is 1.0.0.17. It works but I'm not sure what is missing from the older versions. I do know one thing and that's that I am forever having to "Find the files" even though itunes is showing the songs. In other words, after I move out the old and then put the new ones into the same folder (same exact artist-title), when I go to iTunes after dropping the .txt file onto the script, iTunes will show a bunch of exclamation marks - meaning it can't find the songs - even though they're in the same folder. They're just different extensions (mp3 vers lossless ALAC).


So why .17 works and the subsequent ones don't, I can't explain.

Dec 18, 2020 3:29 PM in response to turingtest2

YOU SAID:

OK, just tried replacing some 160k MP3s with some Apple Lossless replacement files. The Bitrate and Kind columns updated as expected during the import phase. Given it seems that you're sometimes seeing the import fail perhaps you're looking at tracks affected by that issue. If you try to play them are they working or broken?


ME: I hope my previous replies today help clarify this. The Export/Import process has a couple elements just to restate:


I have to use 1.0.0.17. All others throw an error on the final step (where I drag the .txt onto the script. The request post says "import metadata for X items?". I say OK and it throws the error I pasted above today. Version .17 does not.

I have to most always play the song (as all have exclamations next to them) and browse to link it up again. Same artist/title, same exact folder location as the original lower-baud rate song(s) - only thing different is the extension. I am using MediaMonkey to convert as I didn't see a need to buy the one I was testing with before.


By the way, I went in and looked at my profile. I had not changed anything so I don't know why I didn't know you replied back on December 9th to my various posts. There was one checkbox unchecked, so I checked it. Hopefully that will help get me the message that you replied. If it's possible, you could email me at "brichards4@aol.com" if you've replied and don't hear from me. I've worked daily on this for quite a long time without a day off.

Dec 18, 2020 3:44 PM in response to turingtest2

YOU SAID:

Just tried here setting a bunch of track ratings, exporting the data, changing them, then importing the exported file to restore the ratings that I'd changed. All worked as expected. Since ratings aren't stored in files they really ought to be preserved without any extra effort from ExportImport. Curious.


ME: What version of E/I are you using? And yes, ratings all seem to work and hold with version 1.0.0.17 that I've been using. I am having other problems though as I've pointed out. It would be interesting to know what exact steps you're taking with your process. Are you converting from .wav to .m4a (ALAC) files? That's what I'm doing. Occasionally I'll convert from .flac to ALAC but 95% are from .wav. Could you archive the steps - and maybe some screen shots? Perhaps I'm making a misstep here that I'm not aware. Once you clarify the playlist issue I asked about earlier today (where I was asking for clarity on the difference between creating a playlist and dragging songs from a folder into it versus just highlighting songs in iTunes and running E/I script.

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.