An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
repairing itunes library
#19403 11/30/11 03:21 AM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
I've had to spend a bit of time on a fairly specialized app to repair a customer's itunes library - this was required because the user's files were scattered in about seven different major areas plus a smaller amount were completely random, including inside emails, trashcans, backup trees, and other odd places. (quite some time ago this user was told to turn off their "copy into library when importing" option, due to a small internal hdd)

Anyway, 1300 playlists and 37,000 tracks makes for 960gb of music and a 53gb, 1.2 million line itunes xml file. (thank you for being awesome, BBEdit!) Now that we have all the files in one place, itunes needs to get the message where all the files went. It doesn't even do you the courtesy of telling you it lost a file until you try to play it.

(no, "consolidate library" was NOT an option before we moved things - files were dragged kicking and screaming off REV disks, internal hard drives, multiple external hard drives, a malfunctioning NAS, and a malfunctioning RAID)

So this has required me to make something to fully parse the "write only" itunes music library xml file, do several FINDs in terminal to catalog the new drobo, and run a script to fix the pathnames in the xml, in preparation to do a wipe-and-playlist-import maneuver in itunes to read the xml back in. (very thankful that's an option) In addition to the gargantuan size of the library, somewhere around 45% of the filenames have unicode-encoded characters in them. (LOTS of foreign titles) So it's been quite a blast to code. Once this xml file is into itunes, we can do a real consolidate library and come back in I'd guess four or five days and it'll all be finished and purdy.

Gives me a new respect for the author of iPhoto Library Manager. Anyway, I was curious if anyone else has or does need this specialized tool, I can make it available if there are any takers. This guy was told by at least three people that what I'm doing right now was "impossible". And that's my favorite thing to code.

Last edited by cyn; 11/30/11 07:11 AM. Reason: Topic moved from "Audio, Video, Photography" forum to "iTunes, iPhone, iPod, iPad, Apple TV" forum.

I work for the Department of Redundancy Department
Re: repairing itunes library
Virtual1 #19407 11/30/11 05:47 AM
Joined: Aug 2009
Likes: 1
Offline

Joined: Aug 2009
Likes: 1
Seems to me that if it's clean and robust, there'd likely be quite a demand for it.


Photo gallery, all about me, and more: www.xeromag.com/franklin.html
Re: repairing itunes library
Virtual1 #19412 11/30/11 04:18 PM
Joined: Sep 2009
Offline

Joined: Sep 2009
Originally Posted By: Virtual1
quite some time ago this user was told to turn off their "copy into library when importing" option, due to a small internal hdd

And that is indeed the correct advice when storing files outside the default "home/music/itunes/itunes music" location... else we would wind up with needless (wasteful) duplication. I've had that option turned off ever since iTunes version 2, when i moved all my music to a dedicated partition.

Downloads from iTMS and rips from our CDs will get stored in the (relocated) media folder as expected... so it's only when adding items that are already sitting around locally somewhere that we would need to physically move items (if so desired).

For someone with such a humongous library, sounds like this person never put much thought into what was actually going on behind the scenes with the song files. Even though iTunes and Mac OS "just work"... some initial organization is required when wandering outside the default setup [e.g., having the media folder be something other than "home/music/itunes/itunes music/".]

While iTunes was initially intended to handle such a "scattered files" scenario as you described, it behooves the user to keep stuff in as few locations as practical (if for no other reason than to facilitate regular backups and potential restore operations).



Originally Posted By: Virtual1
Now that we have all the files in one place, itunes needs to get the message where all the files went. It doesn't even do you the courtesy of telling you it lost a file until you try to play it.

Well, that's true... however, there is a very simple way to force iTunes to study every single filepath from scratch: just do an "Add to Library…" and then select the 'media' folder itself. iTunes will scan every file in the hierarchy [whichever folder we choose] and fix whatever paths it can resolve (if they need fixing), or put exclamation marks on the ones it can't find. I highly recommend doing this only immediately after launching iTunes. [i.e., don't do this after iTunes has been open for a long time]. I say that because i once saw iTunes trip and make its library file double in size. [that happened a while ago, so maybe that bug has been fixed... but better safe than sorry. So, i only do that "Add to Library…" operation on the entire media folder immediately after a fresh launch.]

Last edited by Hal Itosis; 11/30/11 07:35 PM.
Re: repairing itunes library
Hal Itosis #19499 12/05/11 10:47 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
Originally Posted By: Hal Itosis
Originally Posted By: Virtual1
Now that we have all the files in one place, itunes needs to get the message where all the files went. It doesn't even do you the courtesy of telling you it lost a file until you try to play it.

Well, that's true... however, there is a very simple way to force iTunes to study every single filepath from scratch: just do an "Add to Library…" and then select the 'media' folder itself. iTunes will scan every file in the hierarchy [whichever folder we choose] and fix whatever paths it can resolve (if they need fixing), or put exclamation marks on the ones it can't find. I highly recommend doing this only immediately after launching iTunes. [i.e., don't do this after iTunes has been open for a long time]. I say that because i once saw iTunes trip and make its library file double in size. [that happened a while ago, so maybe that bug has been fixed... but better safe than sorry. So, i only do that "Add to Library…" operation on the entire media folder immediately after a fresh launch.]


NOTED! thanks!


I work for the Department of Redundancy Department

Moderated by  cyn, dianne 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.019s Queries: 22 (0.014s) Memory: 0.5894 MB (Peak: 0.6514 MB) Data Comp: Zlib Server Time: 2024-03-28 09:28:26 UTC
Valid HTML 5 and Valid CSS