PDA

View Full Version : iTunes on Mac, SlimServer on unix, case sensitivity issues (solution)



benh
2006-09-08, 07:50
This is really intended to just be a note for the archives in case anyone else runs into the same issue I did. My issue is pretty well sorted.

This is really just a variation on the theme of case sensitivity, but specifically related to tags, iTunes on a Mac, Mac OS HFS and HFS+ filesystems and their interactions with FreeBSD's UFS filesystem (or any other case sensitive filesystem).

The basic problem is that Mac OS's HFS and HFS+ filesystems are not case sensitive. Therefore, if you use iTunes on your Mac and have case inconsistent tags within an Artist or Album, it will cause problems if you elect to run SlimServer on a machine with a case sensitive filesystem, and sync/copy your music store and metadata from the Mac to that other machine. The solution is to make your Album and Artist tags consistent with respect to case. Read on for the long version.

---

I maintain my canonical music store on my Mac OSX 10.4.x laptop and run SlimServer on my home FreeBSD server. I do this mainly so that my Squeezebox's functions aren't dependent on my laptop being awake, online, etc.

I've got a script that occasionally rsyncs my iTunes music files and the associated iTunes Library metadata files to the FreeBSD box. Works well, more or less.

I'd been puzzled by a disparity between the number of songs iTunes thinks I have and the number of songs SlimServer thinks I have. I'd chalked it up to differences in how they look at artists or files and didn't think about it much as I had more pressing things to worry about.

When I finally got around to sorting it out, it turned out I was right, sort of.

The problem was that my songs in iTunes aren't always consistently tagged with respect to case. For example, one album might be tagged with an artist name of "Iris DeMent" and another with "Iris Dement".

Or two songs within the same album, say, "Blonde on Blonde" might be tagged with album names of "Blonde on Blonde" and "Blonde On Blonde".

When iTunes imports the songs, this metadata is written to the iTunes Music Library.xml file with *case intact* as the song was tagged. The songs themselves are copied to the iTunes Music directory.

Problem is that HFS/HFS+, the OS X filesystems, aren't case sensitive by default, so all the songs themselves are written to the same directory, with the case of that directory name apparently set to whichever of the differing Artist or Album tags was first imported.

So, if a song with an Artist tag of "Iris DeMent" was the first song imported by that artist, that's how the directory is named, and all subsequent songs with an Artist tag of "Iris DeMent", "Iris Dement", "iris dement" etc will be put in that same directory.

This doesn't cause problem with iTunes, because the filesystem isn't case sensitive, so it all Just Works with iTunes because it's all the same to the filesystem.

However, when SlimServer parses the iTunes XML file, it goes to look for the files in the directory as represented (case intact) in the XML file, so sometimes, it's looking for a directory that doesn't exist on a case sensitive filesystem. (It's looking for a directory names "Iris Dement", but the directory is named "Iris DeMent".)

As with most things tag related, the solution is to fix your tags and make Artists and Albums case consistent.

If you think you're having this problem, one way to identify the songs that are problematic is to crank up the itunes and itunes_verbose debug on Slimserver, and write that log to a file. (slimserver.pl --daemon --logfile=/path/to/log --d_itunes --d_itunes_verbose)

Then run a rescan to check for new and changed music.

You can then grep for iTunes: file not found: in that logfile and it'll give you all the info you need.

Hope this is helpful to someone.