Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

iTunes Library on NAS is partially destroyed

I have moved my iTunes Library to my NAS Storage. Everything worked fine.


Until more and more Tracks got scrambled: The location of the file now does not point to the library storage anymore but to a Time Machine location.


I have my Time Machine backups on the same NAS but a different mount point / file system.


Here's an example:

Good file location: /Volumes/music/iTunes/Music/A-HA/Diverse/Move to memphis.mp3

Bad file location: /Volumes/timemachine/MacBook Air.sparsebundle/bands/2440


What strikes me:

A lot of tracks (maybe all?) with a defect location is included in the sync with my iPhone / iPad.


Example: if I have an album from which only one track is on my iPhone, this tracks location is bad, the others are good.


Does anyone have a singular problem – and a solution for it?


Please help!

Thanx, Goetz

MacBook Air (11-inch, Early 2014), OS X El Capitan (10.11)

Posted on Oct 9, 2015 5:17 AM

Reply
16 replies

Oct 9, 2015 5:27 AM in response to iuranien

The real solution? Stop using NAS with iTunes. Something in the file addressing component of NAS may not work well with iTunes, or it may. It is unpredictable and irregular. There's plenty of this kind of topic on this forum and each is slightly different. You may also find it better to keep all the library files in one place rather than having media stored on the NAS. In the end it is better to use a conventional external hard drive and use the NAS for backup.

Oct 9, 2015 6:47 AM in response to Limnos

Thank you for this advice. But I have all my library stored in one place - and that is the NAS.

But Okay, I might better use an external drive.


But still my question is: how do I clean the library? I do not want to delete and reimport everything, for I loose my playlists and my taggings. Is there a way to help to change the location of the file? I can identify the tracks easily, if I only knew a way to correct the entry of the database.


Thanx,

Goetz

Oct 9, 2015 6:58 AM in response to iuranien

I don't know how this actually happened. I believe generally one should not keep Time Machine backups on the same volume as other files.


There is no simple solution to "cleaning" the library. You can edit the .xml copy of the library file, doing a global search and replace on a specific path string in a text editor, then save it again. You then have to create a new, blank library (hold down option key while starting iTunes) and import the .xml with the corrected paths. However, doing this will reset ratings (there are lengthy work-arounds to rescue those), lose play counts, and set date-added to today. Alternatively you can deliberately break the links by removing the files to which you do not wish to link, then (presuming the originals are still in the correct place) find one broken link in the correct location and let iTunes try to repair the others. I am working with about 75% information here so I may not be correctly interpreting the problem to provide an ideal answer.

Oct 9, 2015 7:17 AM in response to Limnos

Timemachine is on a different volume. It only resides on the same NAS. But it still did the wrong job ;-(


I tried a search and replace on the XML-Version of the library but it seems, it does not look there but in the ITL-File.


I also tried creating a new library and adding the XML-File, but iTunes does not import xml-Files anymore. The Menuitem is gone and drag and drop doesn't work eather.


I also cannot delete the files at the wrong direction, because itunes points to files on the timemachine volume. I do not delete them!!! And itunes mounts the volume itself whenever it disconnect from it.


Ist there anyone with applescript-skills? I think of something like: iterate over all files. It the storage points to /Volumes/timemachine than change the location to "absolute nonsens". Then I can correct the location from within itunes.


Does that work?

Goetz

Oct 9, 2015 8:08 AM in response to iuranien

I have no idea how items got re-mapped to the Time Machine volume but then just about every thing that goes wrong with iTunes and NAS is unexplainable.


Search and replace will not work with the .itl version. It is in a form only usable by iTunes. If you saw something readable you were using the .xml


I don't know about import. I use an old version of iTunes. I really cannot believe they have removed it although they may have put it in a secondary level of the menus.


I have no experience in working with Time Machine volumes. My system comes before the era of Time Machine.


I know one of the helpers here has a script for Windows but I do not know of one for Macs. Generally most scripts can be found at the Dougscripts web site but I do not recall one that crawls through a volume looking for files that match library entries.


If you have done a recent backup or recent iTunes application update you could use the .itl file from a previous iTunes version or the backup. Just replace the one you have, then go through and re-do any changes you have made since then.

Oct 9, 2015 1:31 PM in response to iuranien

Hi.


Did you read those paths from Get Info > File tab? Does the second path really not include a filename? Do the bad tracks show with the exclamation mark that indicates a broken entry in the library? If so gathering these into a playlist is quite easy.


I've written the Windows VBS scripts for this sort of task that Limnos mentions, but I've yet to try my hand at converting any of them into AppleScript. They are very different animals. I generally need to do a lot of string slicing which AppleScript doesn't seem to handle so well. I haven't tried it yet under OS X, but with Windows it is only possible to assign a new path to a track if there is a file at the given path.


If all of the tracks that you have added to your device have gone missing do you even have the original to reconnect to? If not see Recover your iTunes library from your iPod or iOS device. Have you made use of the option to convert higher bitrate songs to ??? AAC format? This is sometimes associated with media rot problems.


tt2

Oct 11, 2015 11:19 AM in response to turingtest2

HI there. Sorry being offline for some time.


Yes, I got the paths from "info -> File".

The second path points to a file, not a directory. Therefor the bad tracks to NOT show exclamation marks. Theirs links are not broken but wrong.


iTunes has a recovery function, but it only activates on broken links. If I unmount the timemachine-volume, it reconnects automatically if I access the bad track.


I think I could write an applescript script myself if I only knew applescript better. I tried yesterday but I could not iterate the correct collection. I even to not need to do a lot of string slicing because I could set every track whose file path begins with "file:///Volumes/Timemachine" with a definitely broken link, and then start the itunes recovery functions. It would be time consuming, yes. But it would *work*. Up to now I do not even have an idea what to do now matter how long it takes (except deleting the library, reload everthing anew, build all playlists from scratch).


For the iOS-devices: After I syncronized, the tracks on the iOS devices are gone as well.


But now file is really gone. They are only not linked anymore.

Oct 11, 2015 1:03 PM in response to iuranien

Dismount the Time Machine volume. Use the following steps to make iTunes detect all lost tracks. Use the Get Info > Locate method to fix the broken links. Remount the volume.



Lost & Found Playlists

Create a playlist called Found, select everything in Music and drag it into the Found playlist (it may take some time to count the tracks that are to be dropped). Create a smart playlist called Lost matching All the rules Playlist is Music and Playlist is not Found. Your lost tracks will be in this playlist.

User uploaded file


tt2

Oct 11, 2015 9:21 PM in response to turingtest2

The playlists might be an easy way to identify the bad tracks. By looking in the xml-file I can find them, too.


Problem is: if I call "Get Info", the timemachine volume gets automatically mounted and the "locate" function does not work (for the link is not broken anymore).


Is there a way to activate "locate" (i. e. change the file of a track) even if the track ist not broken?

Oct 12, 2015 6:09 AM in response to iuranien

I'm some way from becoming proficient with AppleScript, but this would set the path for the currently playing track:


tell application "iTunes"

set location of current track to "<some path as a string>"

end tell

You probably want to iterate over a selection of tracks and calculate the appropriate path for each. To get the current path of a track use something like this:

tell application "iTunes"

set filePathAlias to location of current track

set filePath to filePathAlias as string

endtell

tt2

Oct 12, 2015 6:09 AM in response to iuranien

This snippet displays a dialog box with the path to each selected track.


tell application "iTunes"

if selection is not {} then -- there ARE tracks selected...

set mySelection to selection

repeat with aTrack in mySelection

set filePathAlias to location of aTrack

set filePath to filePathAlias as string


display dialogfilePath -- replace this with code to write a new path where needed

end repeat

end if

end tell


Not sure why this isn't coming over with all of the colours and indents. 😕


tt2

iTunes Library on NAS is partially destroyed

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