Saturday, March 7, 2009

The Music Anywhere Project

Thought I would post about my 'Music Anywhere' project... I've been thinking for a long time that I would get jungle disk or something similar working, and maybe setup backups, but primarily just upload all my music, and use it as my music repository. Well, last weekend I decided to take the plunge.

JungleDisk is pretty impressive. I tried it out shortly after S3 launched, and it wasn't too great back then. In fact, I couldn't get it working on either my Mac laptop or my windows pc at home. I abandoned the project at that point... Last weekend, though I just downloaded jungledisk and was off and running.

Getting jungle disk up and running (even with automated, versioned, backups) was very very easy, jungle disk is well worth the $20 (+ $1/month for "plus" service that lets you access your files via the web). The hard part was actually getting all the data uploaded. Evidently my modem or comcast or something destroys my connection with very much upload at all. I was able to get some of it uploaded, but it was basically powercycling my modem every hour to do that. So I just waited until monday and started the very long process of uploading 32gigs of music/video to s3.

Following the advice of another blog post, I actually used the "consolidate library" feature of iTunes to move the files... Which would theoretically allow me to upload files and have itunes change their location in its database to the network drive location. This was a bad idea... iTunes frequently crashed, I had to restart the laptop about twice a day to keep the upload going, and at the end of it, though all my music was uploaded (I wrote a couple of scripts to check that), itunes only had the right location for about half of it.

I tried modifying the itunes library files to point to the correct location (there are XML files sitting in the base directory), but taht didn't work. It turns out that iTunes actually uses a binary flat file for its db, and those XML files just get re-written about every time anything changes (more on that later). Eventually I gave up, started a new library (which lived on the network drive itself, so that I would have a backup) and just re-imported my old library + playlists.

This worked, to an extent. Unfrotunately iTunes still felt like re-writing its db quite a bit, and it caused jungle disk to re-pull every single file, since itunes had to analyze each file for gapless playback. This ate through a good chunk of outgoing bandwidth. Additionally, I still had the crashing issues, though that was old hat by this point.

The final tweak to the setup came when I tried to get my phone to sync to my "new" itunes library... evidently iTunes doesn't deal well with slow I/O (like a s3 network drive) and mobile applications for the iPhone. So I moved the library files back to the harddrive, and things are working well now. (BTW, hold down the 'option' key to select a different library from your default startup library).

Most of this would've been able to be avoided if iTunes let me fix up its DB manually, or if I used something other than iTunes for playback (but I'm still tied to iTunes' DRM until this summer at least). But, I did get backups for my home computer, which will ensure that I won't loose a passel of RPG notes, characters, and systems like I did about a year or so ago, again, which is a great thing.

If anyone wants to attempt this here are my suggestions:

  1. Have a high-speed uplink, doing this at work still took 3 or so days, and they have a fantastic uplink
  2. Just copy the files over, use rsync or something so you can resume easily (don't let it md5 sum the files)
  3. Export your current playlists using itunes, then start a new library and import the file, after using sed or something to fix up all of the file locations.
  4. Give jungle disk a file cache size large enough for your entire collection, its a lot better when jungle disk doesn't have to re-pull files from s3

BTW, as of right now, this whole project has cost me about $16 in s3 fees, and about $21 dollars for jungledisk, I estimated about $5 per month in storage / bandwidth fees for s3, we'll see how accurate that is!