Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rating: Thread Rating: 11 votes, 5.00 average. Display Modes
Old 01-22-2011, 10:22 PM   #1
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
Problems with iTunes Library file

I'm running Snowleopard 10.6.6
I'm running iTunes 10.1.1

I've got about 5000 tracks. My library is on an external firewire connected drive called MongoDisk.

Currently, about half of my tracks have the dreaded grey ! on them.

If I look at the info for the file it shows up as being in

file://localhost/Volumes/MongoDisk/path/to/song.m4a

Now if I correct it, I find the new file at /Volumes/MongoDisk/path/to/song.m4a and all is well.

Now if I look at the info, it no longer says file://localhost/Volumes.

However in the xml file it is still in the file://localhost/...
(Itunes_Library.xml is the original file.)

iTunes Library.xml: <key>Name</key><string>Acapulco</string>
iTunes Library.xml: <key>Location</key><string>file://localhost/Volumes/MongoDisk/SGB-Music/Music/Neil%20Diamond/Jazz%20Singer/09%20Acapulco.m4a</string>
iTunes_Library.xml: <key>Name</key><string>Acapulco</string>
iTunes_Library.xml: <key>Location</key><string>file://localhost/Volumes/MongoDisk/SGB-Music/Music/Neil%20Diamond/Jazz%20Singer/09%20Acapulco.m4a</string>
Tigger-2:iTunes sherwood$

Yes I've checked that this is the current library. (Find all files containing Library.xml as part of their name, and see which one has changed at the right time.)

I'm missing something here.
sgbotsford is offline   Reply With Quote
Old 01-23-2011, 06:57 AM   #2
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
Unhappy

One of the things I'm missing:

...Library.xml is write only in normal operation. Changes made to it are ignored by iTunes.

I tried the following:

moved ...Library.itl to Library.itl.back
opened itunes.
imported playlist from ...Library.xml.

Got an error message "some files couldn't be found" The track count at the end was half of what it should be.

Quit iTunes, and copied the .back file back.

This indicates that whatever is wrong *IS* wrong with the xml file too.

Stay tuned.
sgbotsford is offline   Reply With Quote
Old 01-23-2011, 07:35 AM   #3
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
Or not...

Just did the following check:

Opened iTunes.
exported library to Library.xml
Fixed one song.
Quit iTunes
Opened itunes
exported library to Library2.xml

ran md5 L*xml
Both files had the same checksum.
sgbotsford is offline   Reply With Quote
Old 01-23-2011, 02:32 PM   #4
ganbustein
MVP
 
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,181
Quote:
Originally Posted by sgbotsford
If I look at the info for the file it shows up as being in

file://localhost/Volumes/MongoDisk/path/to/song.m4a

Now if I correct it, I find the new file at /Volumes/MongoDisk/path/to/song.m4a and all is well.

Now if I look at the info, it no longer says file://localhost/Volumes.

However in the xml file it is still in the file://localhost/...
(Itunes_Library.xml is the original file.)

file://localhost/Volumes/MongoDisk/path/to/song.m4a
and
/Volumes/MongoDisk/path/to/song.m4a

are two different ways to say the same thing. That they say the same thing doesn't mean they're interchangeable, though. The former is a URL, the latter is a POSIX path. Think of them as equivalent phrases in two different languages. A program will store a URL in a place where it expects to later find a URL, and it'll get confused if it finds a POSIX path there instead, and vice versa. It just happens that iTunes has decided to store URLs in iTunes Music Library.xml but show the equivalent POSIX path in Get Info. There's nothing to get alarmed about here.

You say you "correct" it. What exactly are you correcting, and how? You aren't editing files behind iTunes' back, are you? That never ends well.

The file that iTunes provides for the benefit of third-party applications is named "iTunes Music Library.xml", not "iTunes Library.xml". The file that it relies on internally is "iTunes Library", not "iTunes Library.itl". This is with iTunes 10.1.1, the version you say you're using.

One common bug with applications that look for files on external disks using absolute paths (whether via file:/// URLs or POSIX paths) is that under some conditions if the volume is not mounted the program will erroneously create a folder with the expected name in /Volumes. Future searches for the file will look in this folder instead of on the external disk, even after the external disk is later mounted. I'm not saying iTunes has this bug, but given that something is amiss it can't hurt to double-check.

Give us the output from
Code:
ls -alOei /Volumes
id
echo done
ganbustein is offline   Reply With Quote
Old 01-23-2011, 03:46 PM   #5
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
Problem Solved.

Doug's itunes apple scripts saves the day, once again.

http://dougscripts.com/itunes/script...itunestrackcpr


To answer your question: Yes I'm aware that URI and posix semantics. I simplified it somewhat: The actual music library is:

/Volumes/MongoDisk/SGB-Music

The library itself is

/Volumes/MongoDisk/SGB-Music/iTunes/iTunes\ Library.itl

So if Mongo is offline, itunes will fuss about not finding the library file.

If it had been a permissions problem, implied by your choice of commands, I would have problems with the entire library. However the problem was tracks seemingly at random.

As to how I made the 'corrections', this was done within iTunes:

"Can't find file" Do you want to locate.

Yes.

File browser modal panel comes up.
Type partial name in spotlight
switch from contents to filename
pick the one match.
click choose.

Takes about a minute each.

Doug's script fixed all 2561 of these in about 10 minutes.
sgbotsford is offline   Reply With Quote
Old 01-23-2011, 08:14 PM   #6
mnewman
MVP
 
Join Date: Apr 2002
Location: Korat, Thailand
Posts: 2,046
I just had a very similar problem where all of a sudden half my library had the dreaded "!".

When I looked at the Library XML file I found entries like this:

<key>Location</key><string>file://localhost/Users/mnewman/Music/iTunes/iTunes%20Media/Music/Compilations/Remington/Tequilla%20-%20Herb%20Alpert.lproj/</string>

and this:

<key>Location</key><string>file://localhost/Users/mnewman/Music/iTunes/iTunes%20Media/Music/The%20Eagles/Hotel%20California/09%20The%20Last%20Resort.nib/</string>

Somehow all of the correct file extensions for the missing songs (.mp3, .m4p, etc.) had been replaced by .lproj or .nib.

I ended up fixing by finding a recent backup of the library.

Unfortunately, the corruption continues. iTunes cannot locate "Lullaby" by A Perfect Circle. Get Info on that song shows:

file://localhost/Volumes/Clorox/System/Library/PrivateFrameworks/CoreMediaPrivate.framework/Versions/A/Resources/

Ooops! The volume Clorox is a CCC backup volume that is only mounted during a CCC clone operation.

It turns out that the song "Lullaby" was deleted from the iTunes Library on January 3rd (based on Time Macine backups). Not by me.

I restored the song and "found" it for iTunes which duly asked if I wanted to locate other missing songs based on the location of Lullaby. I answered affirmatively, but iTunes couldn't find any of the 57 songs it now thinks are missing. Here's one of them:

file://localhost/Volumes/Clorox/System/Library/PrivateFrameworks/ScreenReader.framework/Versions/A/Resources/Dutch.lproj/SCROutputDefaultUserSubstitutions.strings

I wasn't able to find any others.
__________________
http://www.mgnewman.com/
mnewman is offline   Reply With Quote
Old 01-24-2011, 11:53 AM   #7
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
THAT is truly bizarre. Apple are you listening?

lproj and nib are suffixes for app directories. lproj is for translations of the interface -- makes it easy to make a french version of your software. nib's are something to do with the screen layout, I think.

I'm trying to imagine a scenario where this could happen:




Hmm. Remember that the xml file is only a backup/convenience for other programs. The itl file is the canonical storage place for itunes.
sgbotsford is offline   Reply With Quote
Old 01-24-2011, 06:34 PM   #8
mnewman
MVP
 
Join Date: Apr 2002
Location: Korat, Thailand
Posts: 2,046
Oddly, I do not have any file with the extension .itl:

Code:
Bleach:~ mnewman$ cd /Users/mnewman/Music/iTunes 
Bleach:iTunes mnewman$ ls -lea
total 62544
drwxrwxr-x  13 mnewman  staff       442 Jan 24 19:22 .
drwx------+  8 mnewman  staff       272 Jan 19 14:13 ..
 0: group:everyone deny delete
-rw-r--r--@  1 mnewman  staff      6148 Jan 21 16:37 .DS_Store
drwxr-xr-x   5 mnewman  staff       170 Jan  2  2010 Album Artwork
drwxr-xr-x  88 mnewman  staff      2992 Jan 19 13:37 Mobile Applications
drwxr-xr-x   9 mnewman  staff       306 Jan 19 12:53 Previous iTunes Libraries
-rw-r--r--@  1 mnewman  staff   2206755 Jan 24 19:22 iTunes Library
-rw-r--r--@  1 mnewman  staff   2157894 Jan 19 12:44 iTunes Library (original)
-rw-r--r--   1 mnewman  staff    491520 Jan 24 09:18 iTunes Library Extras.itdb
-rw-r--r--   1 mnewman  staff  16695296 Jan 19 12:55 iTunes Library Genius.itdb
drwxr-xr-x   6 mnewman  staff       204 Jan 19 12:27 iTunes Media
-rw-r--r--@  1 mnewman  staff  10454899 Jan 24 19:22 iTunes Music Library.xml
-rw-r--r--@  1 mnewman  staff         8 Jan 24 09:18 sentinel
The problem first surfaced when I was syncing my iPad with iTunes. I got an error message listing hundreds of songs that were not synced because the file type was incompatible with the iPad. (Of course, the iPad can't play a .nib file…)

Isn't the .xml file derived from the iTunes Library file?

Does the "Get Info" in iTunes get its data from the .xml file or the Library file? When I did a "Get Info" on the songs with .nib or .lproj extensions iTunes first complained that it couldn't find the file. It then displayed the "Info" dialog box which showed the corrupted file names and paths.
__________________
http://www.mgnewman.com/
mnewman is offline   Reply With Quote
Old 01-25-2011, 12:15 AM   #9
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
Yes, the xml is derived from the library file. Don't know why your's doesn't have the .itl suffix. Note that they both have the same mod time.

I would expect that Get info in itunes would get its data from the .itl file, not the xml file. XML is secondary.

The .itl file is compact: It's 1/5 of the xml file, and has some additional data in it. (What? Anyone know?) AFAIK neither file is kept in any particular order, I suspect that the xml file is in the same sequence as the itl file, but this is just a suspicion based that it's easiest to write out that way. Why generate a random order? They both may be in the order of acquisition into itunes.

Doug's scripts has a 'bring out your dead' which makes a list of all the files in the library that aren't in your music folder. He also has one that finds all the music in your folder that isn't in your Library. These may help.
sgbotsford is offline   Reply With Quote
Old 01-25-2011, 01:02 AM   #10
mnewman
MVP
 
Join Date: Apr 2002
Location: Korat, Thailand
Posts: 2,046
It seems like some of Doug's fine scripts ought to be built in to iTunes. At minimum there ought to be a "Repair Library" command that attempts to fix (with a Spotlight search?):
  • Tracks in your Media Folder that are not in your Library
  • Tracks in the Library that are not in the Media Folder
__________________
http://www.mgnewman.com/
mnewman is offline   Reply With Quote
Old 01-25-2011, 10:40 PM   #11
sgbotsford
Prospect
 
Join Date: Jan 2011
Posts: 13
Just discovered another oddity.

Running Doug's script, "Bring Out Your Dead" gave me an additional list of 60 some tracks that weren't fixed by the CPR script.

I started to fix them one by one. One bunch were 16 tracks from a single album.

After the 3rd or 4th fix, I opened the containing folder in Finder, clicked on them one by one. Of course they opened in iTunes, and all at once the grey ! disappeared.

I have recently run Repair Permissions on this disk, and it is was clean. go Figure.
sgbotsford is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 11:30 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.