battis.net and I'm all out of bubble gum…

For the past few years (well, since I’ve had an iPad), I’ve been exasperated by the time it takes whichever app Apple has streaming video from my iTunes library to my iPad to load my iTunes library. In the past, it has taken anywhere from 20-90 minutes to load the library each time I access it. Clearly, this isn’t really viable as a “streaming TV in bed” approach. I did some digging around, and it seems like the root issue is that my iTunes library is too big, so the iPad app can’t process the XML file it has to download (aside: this is ridiculous, of course).

Long story short, at the start of the summer, being blissfully unemployed, I took a moment to split my iTunes library in twain: one library of music and audiobooks to sync to my phone (not that that integration has been getting any better, mind you) and one library of movies and TV shows to stream to the AppleTV and my iPad and whatnot. (Note: this whole time the AppleTV could load my gigundous library… but not the iPad. Oy.)

Much metadata cleaning later (because it turns out that iTunes doesn’t actually write all the fields it should write to video files, because, well… it’s lousy), I now have two libraries. Most of the time I want the movies and TV library open, but I want to regularly open the music and audiobooks to sync podcasts (not that I trust Apple for that either: greg is in charge of syncing, iTunes just adds the new files to the library).

In the past, I’ve noted that I’ve found CLI defaults tool to be useful for managing a remote iTunes library. This proves not to be the case here — in fact, the solution is one of simple symlinking. I’ve written three scripts: a “master” script that just toggles between libraries and two “client” scripts that just pass a specific parameter to the master script (depending on which library should be opened).

August 12, 2017 edit: I have found that AppleScript is just too flaky for this operation, and have switched to an end run around iTunes using bash scripting. The original AppleScripts are still available, but I recommend the bash approach below at this point:

It’s worth noting a few things here:

  1. This script assumes that there is no actual valid iTunes library (or even a directory) at ~/Music/iTunes — the script operates by swapping out symlinks at that location to other libraries. The script does do a sanity check before trying to effect that swap, of course.
  2. I initially tried to do this using system accessibility scripting but found that to be unreliable (pasting the path into the “go to folder” dialog as iTunes opened was flaking reliably).
  3. Along the way, while I could have used the CLI osascript command to open the “master” script with appropriate parameters in the crontab… I couldn’t figure out how to give osascript appropriate permissions in the accessibility section of the Security & Privacy system preferences. Frustrating. [August 12, 2017 edit: …and I no longer both to schedule switching libraries with crontab anyway.]

July 30th, 2017

Posted In: How To

Tags: , , , ,

css.php