Previous 1 2 3 Next 33 Replies Latest reply: May 30, 2014 4:07 PM by turingtest2
thelovelyman Level 1 Level 1

iTunes sent 80% of my songs (about 20000 songs of 475GB) into Unknown Artist/ Album folder. My songs were ripped in .WAV and .AIFF formats and residing in 1.5 TB external hard disk. I realise how to rebuild them manually (through 'locate and search' but it will take eternity to complete. I don’t have backup copy of my music file and I can’t re-import (ripping) them from the CDs.

Is there software that can rebuild songs from this Unknown artist/ album folder back to the Artist/Album folders on iTunes Media/Music/.... (or to any specified directory/folder).

All my itunes library files, music metadata are intact. Artwork, Album, Artist name and track number and song names, genres etc are showing on itunes GUI. This problem should be technically solvable by a program. Any help or pointer in the right direction will be appreciated.

Solved by turingtest2 on Jan 6, 2012 9:31 AM Solved
OK, here we have an album in my test library in the standard location for it...  Now I'm going to simulate the disaster by renaming the folder containing the files as Unknown Artist\Unknown Album. Note how each track now shows the ! for missing tracks.   Next I select the 12 tracks and run the FindTracks script.  I've clicked No on the first prompt so that I can get track by track confirmation. Next I check that the correct path has been assumed for the media folder to be searched. Note this must be a parent folder of where the files actually are. The script may not guess this initial value correctly if content is split over multiple paths/drives instead of the standard iTunes layout.  The script will search the following potential locations for each track:<Media Folder><Media Folder>\<Album Artist><Media Folder>\<Album Artist>\<Album><Media Folder>\<Artist><Media Folder>\<Artist>\<Album><Media Folder>\<Album><Media Folder>\Compilations\<Album><Media Folder>\Music<Media Folder>\Music\<Album Artist><Media Folder>\Music\<Album Artist>\<Album><Media Folder>\Music\<Artist><Media Folder>\Music\<Artist>\<Album> <Media Folder>\Music\<Album><Media Folder>\Music\Compilations\<Album><Media Folder>\Music\Unknown Artist\Unknown Album<Media Folder>\Unknown Artist\Unknown AlbumWith optimizations when <Album>=<Album Artist>=<Artist>. For all searches outside of the Unknown Artist\Unknown Album folder there is a fuzzy matching mechanism which can cope with, for example, longer/truncated file & folder names or different filename character substitutions. Other types of media will be searched for in their usual locations relative to the media folder.(Note to self: Add in ability to cope with missing track numbers) Having confirmed the media location the script comes back with the first proposed correction. Yes will update the location of the track, No will skip that track, and Cancel aborts the script.  After all the tracks have been processed, or you press Cancel, there is a summary of the activity. Obviously confirming each track one at a time would be boring so once you've proved the script is effective it is time to run it on larger groups of files in automatic mode which will display a progress bar so you can see that it is still working. If you close the progress bar the script will safely complete its current operation and then offer to abort or resume.  tt2
  • K T Level 7 Level 7

    There are tons of iTunes AppleScripts around for things like this, but this sounds more like a job for a tested and reliable backup sorry

  • turingtest2 Level 9 Level 9

    The downside with WAV files as a media format is that they don't retain tag information. AIFF files however ought to contain a tag which can hold details such as track number, name, artist & album even if some more esoteric fields aren't preserved.


    If iTunes wasn't managing your file & folder names when whatever "accident" happened then most of the important information could have been recovered from the paths, but if I read you right the tracks are no longer connected to iTunes and have also been jumbled up in the Unknown Artist\Unknown Album folder. You can't undo that loss of data. The tools that could identify the tracks from their audio fingerprints, such as MusicBrainz Picard, won't work since they can't write the information to a non-existent tag.


    Offhand I don't think there is any easy way back from the mess....



  • thelovelyman Level 1 Level 1

    @ turingtest2: Thanks.


    I am thinking since it is possible to manually rebuild the jumbled songs (through 'locate and search') back into the appropriate itunes Artist/ Album folder, there should be a way to automate the manual process.


    I just need a written code that can search the songs in the Unknown Artist/ Album and match the songs with the itunes Library database (which I believe are still intact) and restore it for me (instead of me doing it manually). At least I rebuilt one album manually....and I think rebuilding one album wouldnt have been possible if required tags or metadata info necessary are lost.


    The logic needed (which is subject refining) is:


    Pick a song in the Unkown Artist/ Unknown Album folder,

         Get the song's information (i.e. name of song, size in MB, length of play, date modified, song format ie. .wav or .aiff);

         Match the information with that in the itunes database (size, length of play, song format, album name, artist name);

    return the matched song to the corresponding Artist/ album to a specified location/directory




    That is pretty much what I did manually.


    I am not looking for a tool that will use any database (or tags) outside what is residing on my computer. I need someone who can put my logic into a code. And if there is something that i have not put into consideration for my logic to work, I like someone to enlighten me e.g if iTunes had protected its Library database from being searched with a written code.


    If my logic can work and the itunes database can be searched, I want to believe someone somewhere must have written and use such a code. And if not someone can write it. Programmers, where are you?

  • turingtest2 Level 9 Level 9

    thelovelyman wrote:


    Programmers, where are you?


    Well I'm here. I was about to say that I still wasn't optimistic but as long as the files are in a ## <Name> format that gives us a fighting chance. The number of occassions when a given combination of track number and track name appears on more than one album isn't that high, but it certainly happens. Thankfully I've just discovered that I I can read the size of the missing file from the database, even if I can't read the last known location, so chances are that there is something I can do after all. I shall need to think about it a bit...



  • turingtest2 Level 9 Level 9

    Any chance you could scan through your Unknown Artist\Unknown Album folder looking for duplicates and throw some examples back at me. Filenames that are almost the same as another but end with " 1.<ext>", " 2.<ext>" etc. I'm just testing out a modification of my existing FindTracks script which makes it look for missing tracks in the Unknown Artist\Unknown Album folder as well as the usual locations. There's some fuzzy matching logic that needs fine tuning and it might help to see some real world examples.



  • turingtest2 Level 9 Level 9

    Hmm, 20,000 songs in the one folder yes? I'll definately need to change the way the script looks for matches. Currently it processes every file name in the folder generating a fuzzy matching pattern. The overhead for testing a dozen files in the same folder isn't that great but 20,000 would be prohibitive.



  • thelovelyman Level 1 Level 1

    Thanks for your time.


    Have you tried to rebuild (ie. play) any song having exclamation ! mark against it? Give it a try. That's if you have not deleted the Unknown Artist/Unknown album folder. You will be able to play the rebuilt song but will still have the directory as Letter:/Unknown Artist/Unknown Album/Songname.wav. The fact that it can be played suggests it can be rebuilt into its Artist/Album folder which is still showing on the itunes GUI (hence in the itunes library database)


    How to play the song:

    Click on the song having ! mark

    It will ask if you want to locate the song. Click yes.

    Locate the folder form Computer/User/... Music/Unknown...  

    Search for the song by its name (a few letters may be enough).

    Hover over the song to ensure it has same size (kB or MB) and track lenght with that itunes GUI.

    Double click on the song. The ! marks dissappears and it will start playing.

    Note that using 'Get Info' shows that the song is now located on Letter:/Unknown Artist/Unknown/Songname.wav folder

    The song is lost again when you close itunes.


    I dont think duplicate song (e.g love1.wav and love2.aiff) can pose much problem. RINSE and TUNEUP trial version program have given logic on how to eliminate duplicates. 


    Note: if you hover on some songs in the Unknown folder there can be a difference of 0.01 sec in track length of same song in the iTunes GUI.



    Itunes organised RULE is a combination of :

    iTunes/iTunes Media/Music/Artist Name/Album Name/songs


    Itunes/Itunes Media/Music/Compilations/Album/songs.. (for Album that has more than one ARTISTS)


    The LOST song destination is:

    Itunes/iTunes Media/Music/UNKNOWN ARTIST/ UNKNOWN ALBUM/songs (same applies for Compilation albums)


    The song is not actually lost. It is simply not organised into the rule which itunes will naturally play.

  • thelovelyman Level 1 Level 1

    Correction: The song is not lost lost again after closing the itunes

  • thelovelyman Level 1 Level 1

    Duplicate songs:


    The song:

    4 Stay until summer.wav


    Duplicates on itunes GUI:

    4 Stay until summer 2 2.wav

    4 Stay until summer 3.wav


    Duplicates in Unknown Artist/ Unknown Album folder:

    04 Stay until summer.wav

    04 Stay until summer 2.wav

  • turingtest2 Level 9 Level 9

    If the tracks are obviously duplicates of the same song in both the iTunes GUI and the folder that isn't so much of a problem. I was thinking more of this scenario:




    Where what should be three potentially different takes of the same song also have the same track number on their respective albums. As a result, following a similar accident to yours, they would be called "04 Ziggy Stardust.wav", "04 Ziggy Stardust 2.wav" & "04 Ziggy Stardust 3.wav". Using the size to confim the identity is easy enough to do by eye and I could implement that in my script at some point, but I'm thinking I need to turn off the fuzzy pattern matching system that could test for there being more than one potential match in the same folder as with 20,000 files it would run too slowly. Instead I've tweaked the script so that only look for a single precise match in the Unknown Artist\Unknown Album folder for the sake of efficiency.


    The result of running the revised script on the selection above would be that all three tracks would be connected to the same file (if iTunes doesn't move them after they have been reconnected) or they might be connected in the wrong order. Just in case, use the Find Duplicates tool first, put the library in name order, and manually relink any same track name & number occurrences. Also take a backup copy of your iTunes Library.itl file before you proceed any further.


    I've done tweaking and testing the new build of FindTracks which should now be able to sort things out for you. I strongly recommend you disable the option to "Keep iTunes Media folder organized" for now. You can re-enable it once the script has done its work so that iTunes can reorganize the files back in their proper folders, then disable it again to avoid a similar problem in future. I have a script called ConsolidateByMoving that you can use on selected items instead. I also suggest you take a look at my User Tip on backing up.


    Select a few broken tracks for the first pass, say no to the first prompt, confirm the media folder then check each "correction" before it happens. If that's good try a larger batch on automatic. Still good? Set the rest in motion and give it some time.



  • thelovelyman Level 1 Level 1

    Thanks for the Scripts. The FindTracks did not rebuild the path; its still in the Itunes/Itunes Media/Unknown Artist/ Unknown Album/songs


    The objective is to link the song to the Artist and Album which are still showing on the itunes GUI. Is there something I'm missing in the implementation?

  • thelovelyman Level 1 Level 1

    Cant the path be linked and Artist and Album folders recreated as Itunes/itunes Media/Music/Artist/Album/songs ? Thanks.

  • turingtest2 Level 9 Level 9

    Hi. Perhaps I'm not very good at explaining how the script is supposed to be operated for it to work, or my assumptions about where the files are and what file names they will have are way off. Give me a little time and I'll throw up some screenshots of my test scenario.



  • thelovelyman Level 1 Level 1

    The Script worked (it processed and summarised what was done and time taken) but the objective of getting the songs back in the approriate path ...Itunes/itunes Media/ Music/Artist/Album/song...  has not been met. When I checked the location of a song that has been linked, it is still in the path Itunes/itunes Media/ Music/Unknown Artist/ Unknown Album/song. Rebuilding songs should link and build. I like to see the songs built back in the Album folder (and Album in Artist folder); and if various Artists are involved, the songs back in the Album folder (and Album folder in Compilations folder). Was the Script designed to do that? Perhaps its just impossible for so and so reason. Thanks.

Previous 1 2 3 Next