Skip to main content
Enthusiast I
July 6, 2009

iTunes Library Manager

For Sonos users who wish to choose which of their iTunes playlists are transferred to Sonos or for users who wish to use lossy formats for their ipods and lossless for their Sonos system. It makes a custom XML file on the NAS with unselected playlists removed and/or references adjusted to the lossless files. If you wish to only transfer a subset of playlists the application can be configured to display a playlist selector before the custom XML file is generated. The application can be configured to run and create the custom XML file on your NAS each time iTunes is closed.

http://www.darrenlink.talktalk.net/ituneslibrarymanager

http://www.darrenlink.talktalk.net/ituneslibrarymanager/download

I have written an application that solves two main issues for Sonos and iTunes users. Many people like to use iTunes to catalog their MP3 collection for use with iPods but prefer to store lossless files (perhaps apple lossless) on their NAS for use with Sonos. The "iTunes Music Library.xml" cannot be simply placed on the NAS as all the tracks are pointing to the lower bitrate MP3 files. Also many iTunes users have too many playlists to be imported into the available Sonos memory. (Especially if lots of smart playlists covering your entire library are defined)

My application solves the above two problems by changing the paths of the MP3's (or other lossey file types) within the "iTunes Music Library.xml" to the equivalent paths of the lossless files. It also allows the user to choose which playlists they wish to be imported into their Sonos system from their iTunes library. It also eliminates the need to maintain two separate iTunes libraries (although you are still required to create lossey and lossless copies of each track)

The application caches (and maintains) a one to one mapping between each file in iTunes with the equivalent higher quality file on your NAS. This caching allows the application to run through approximately 10,000 tracks on my PC and write an alternative xml file to my NAS pointing to the lossless files within about 25 seconds.

The application is completely configurable so it can be configured to match your setup.

More information, screenshots and the download link are above.
This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

111 replies

Contributor I
June 23, 2011
Thanks for the reply Darren, sorry I only just thought of checking this forum now! I decided in the end that I wanted to re-rip my library as it had developed over several years and I'd changed MP3 encoders, bit-rates, formatting of ID tags etc - this gives me a good excuse to start again! I decided to keep the existing files as they were, and created new \Music\HQ and \Music\LQ folders. I'm putting the newly-ripped FLACs into the HQ folder and new MP3s into the LQ folder, then deleting the originals wherever they may be. The new HQ stuff goes to my Sonos-indexed share on the NAS, along with all the older versions; the LQ just goes to a another share for backups (and into my iTunes library).

As time goes on it all gets neater and neater in the Sonos music library, its all good fun! Eventually I'll be left with some folders in my older structure, and will have to work out where they came from and what to do with them! I set up the transform rules (convert MP3 to FLAC, else leave as MP3) and they work fine now over the whole music folder, so that's great, plus of course I get to select which playlists to bring across to avoid hitting the maximum. It all works great!

I never looked at the "Add New iTunes Library" option till, now, so that makes sense rather than re-code for my suggestion - thing is, I haven't looked at multiple iTunes libraries before but I think that may be useful. I manage my wife's iPod along with my iPod & iPhone, all from one library at the moment. My whole system is based on song ratings, only 3+ gets on my iPhone due to space limits, 2+ on my iPod. My wife just has her music in one playlist, not all of it stuff I would like and I'm always worried she will start rating her songs, causing me problems with my iPhone sync!! Plus I have other playlists for songs not listened to for a while, but of course, her stuff wouldn't show in that because she listens to them! I presume multiple libraries would sort this out, but I'm so nervous to mess around with it in case it all goes wrong - I guess I have backups of the whole iTunes folder so I could try it out...

Is the "iTunes Music Library.xml" the sole source for iTunes, would just that file alone let me recover from an iTunes screwup? I don't know what the .itl or .itdb files do...

Just rambling now, I'm inspired to learn how to code a VB program to read the XML file and give me a more accurate rating of my albums, its annoying that iTunes doesn't properly sort my albums by rating - e.g. it just lumps all the 4* albums by album name I think - you can see in the XML the album rating is either 20/40/60/80/100. I used to program a long time ago, done a little VB recently so I should be able to manage it...

Thanks again,
-Durwin
Enthusiast I
June 28, 2011
Hi Durwin,

I am very pleased to hear that my app is working well for you.

The iTunes .itl or .itdb files are the main database files for iTunes. The XML file is updated/derived from the main database files each time iTunes is closed. If you create a new empty iTunes library it is possible to import an XML file to recover the full library but the import takes a while for a large library. I recommend that you back up all of the files.

From my mp3 iTunes XML file I can generate my lossless version (pointing to my apple lossless files) using my app and then import that file into a new iTunes empty library to create the equivalent lossless version of my library. This won't work for Flac files however as iTunes cannot import or play them.

Having multiple libraries can be handy but switching libraries could be easier. You may consider creating separate Windows user accounts for yourself and your wife. Each user profile will have their own iTunes library files under My Music and you will not need to worry about switching iTunes libraries as you start iTunes.

If you are interested in learning C# I could send you my Class that reads in the XML file, manipulates it and re-saves it. As iTunes ignores the XML files upon startup you will need to re-import a modified XML file into a blank iTunes library to see your modifications.

One feature of my app that I haven't really talked about is the ability to create a new XML file with stripped out track user data such as play counts and ratings. You may wish to create an XML file with this information stripped out before importing your library into a new blank iTunes library for your wife.

Thanks for your feedback.

Darren
Enthusiast I
April 5, 2012
I had a quick chat with www.simplysonos.co.uk over lunch today about buying two Play 3's as a retirement present for my dad. I have asked them if anyone has any contacts at Sonos that could provide a sample C# .Net solution for kicking off the Sonos indexer reliably. I hope they are able to come back with something. I'll then be able to incorporate it in a new release. It's a much needed missing piece to my app. I will make it an optional feature of course. It'll probably be disabled by default but easy to turn on.

I have rather neglected this thread since last summer and haven't made any changes to the application since the last release.

I must work out how to do a poll to get an idea of how many people may be using my application. I have absolutely no idea and would love to know !!! There have been over 20,000 views of this thread but I may have scared a lot of people off giving it a go with all of the geek talk. I should create a simple "best practice / step by step" guide for how to use it. For anyone living near Ashford, Kent, UK I could provide some help with library set up and hands on training.

Fingers crossed for the technical help from SimplySonos.

Darren
Rephlex
Avid Contributor I
April 5, 2012
I for one am still using it simply to copy the Library to my NAS. A great little application and I'm very grateful for it.
BarryM
April 5, 2012
I have asked them if anyone has any contacts at Sonos that could provide a sample C# .Net solution for kicking off the Sonos indexer reliably.

Trigger the keyboard shortcuts?
Alt M
M
Enter

Maybe your Dad could just use the above shortcuts? ... Although if he hits Ctrl M he mutes the zone, and you get a support call I suppose :)

Barry (who handles his 86 year old Mum's PC support)
Contributor III
April 5, 2012
Hi Darren
I use the iTunes Library Manager virtually every day. Its brilliant.
Would be nice to exclude Videos that exist in the Itunes library though as these always come up as exceptions
Enthusiast I
April 5, 2012
Many thanks Rephlex and gsa999 for your positive feedback. I'm sure you have both left positive feedback previously? It's nice to give something back to the Sonos community and to know that it's still being used.

gsa999:
I am aware that videos arent handled by my application but as they are automatically ignored by Sonos anyway I didn't bother to fix it. I agree that it would be nice for the videos to be skipped and not processed at all. If you have a lot of videos it must be annoying to see all of them in the non transformed tracks list. I don't have any videos in my library so it's an issue I always forget about.

BarryM:
Thanks for your keyboard shortcut idea. It's an avenue I had not even considered. It's possible to programatically send keyboard shortcuts to an application but the Sonos desktop controller would need to be opened and made the active window in order to work. I think I should be able to kick off the Sonos indexer without the need for the desktop controller to be open.

Cheers

Darren
BarryM
April 6, 2012
I think I should be able to kick off the Sonos indexer without the need for the desktop controller to be open.

Yes, the dtc manages to kick off a re-index, so it should be possible for you to do it also.

It isn't covered in Sonos' only published api.

Mark Henkelis may have some insight. You could ping his thread at:
http://forums.sonos.com/showthread.php?t=14242


It's possible to programatically send keyboard shortcuts to an application but the Sonos desktop controller would need to be opened and made the active window in order to work.

Since the new 3.7 controller is rather slow to load I have added it into the registry so that it is an autostarted task.
Enthusiast I
May 6, 2012
Hi everyone,

I have been having lots of fun with iTunes match over the last week or so. The service matched 11000 tracks out of my 12000 and I am now using the service to replace my iPod 128/192kbps MP3's with the iTunes store equivalents (256kbps AAC[.m4a files]). This can be done without any additional charges on top of the years subscription (£22). I've already downloaded a very high percentage of my matched tracks and have been storing these in a new share on my nas called music_icloud. For tracks that I have not purchased on CD (i.e. online purchases), I will be copying these to my Sonos share (in the same folder structure) and replacing the MP3's. I have kept my original iPod share unchanged so if I find any bad or poorly matched AAC files I can revert just those specific songs to the original MP3's. Any tracks that I have purchased on CD will remain on my Sonos share in Apple Lossless format (cd rips), without being replaced by the iTunes store files.

My workflow may change a great deal now that I am using iTunes match and iCloud. I am hoping new Cd's can simply be imported as Apple Lossless and then matched to the iTunes store. Once matched I believe I'll be able to move the Apple Lossless files to my Sonos share and then simply download the iTunes store 256kbps AAC files. I am adding tracks to my iPad 3 and my wife's new iPod touch via the cloud. No more syncing via iTunes and the cable. It's slow for bulk loading but its a lot nicer for picking out tracks. It's very convenient being able to play/download any tracks from the iTunes match library wherever you have a wifi connection. If you simply play an album directly from the "iTunes match cloud" the tracks are played and downloaded simultaneously. With a good wifi connection this works without the listener realising the tracks are coming from the cloud, and once played once they are on the device, for offline listening.

I may need to provide an update to my application to support matched tracks in iTunes. Matched tracks show up as "Matched AAC" files in the kind column in iTunes. If this format is stored as the kind in the iTunes XML file I will need to add this format as a recognised source file format in my application.

Once I have got my new workflow process in order I plan to produce a PDF guide (from a word doc) showing how to set up Sonos in conjunction with iTunes, iTunes match and my application. I plan to describe every single step from initial setup to ripping and matching etc. Hopefully I can post this guide in conjunction with an update to my app. I have a holiday coming up very soon so this work may have to wait until I return.

So far I'd highly recommend using iTunes match. After my first years subscription I may cancel as I will have upgraded my entire library to the iTunes store files by that point and would only need the service for getting access to tracks in my "cloud library" when away from home. A big advantage of staying subscribed is that it provides another backup of all of my music (at least in iTunes store quality). Technically I would only really need to backup my Apple Lossless files, but for completeness I would backup the iTunes store files, to avoid re-downloading them using my slow/capped broadband connection.

I hope this is an interesting update for any existing or potential new users of my application

Cheers

Darren
buzz
Grand Maestro
May 6, 2012
DarrenLink,

I'm not an iTunes or cloud user.

If one later terminates the cloud service, does one retain rights to the updated tracks?