Tuesday
Aug242010

iTunes AppleScripts to Clean TV Episode Metadata

This weekend, I dumped a bunch of TV episodes I ripped from DVDs into iTunes, and faced a daunting task to clean up all of the titles and other metadata. Thankfully, iTunes has a special Scripts folder that allows you to easily run AppleScripts on your selected tracks, or even your full library. Here’s a few that kept me sane this weekend:

Put Track Prefix to Track Number

If your tracks are named something like 22 - The Gift, this script will grab the prefix number and copy it to the Track Number field.

Remove n Characters From Front or Back

Once you’ve copied the prefix to the Track Number, clean up that name with this script that lets you strip any number of characters from the beginning (or the end) of the track name.

Track Name Edit with sed

If you need to do a complicated find-and-replace, or anything else sed can do, this script will take the track name and run whatever sed command you type into it. If you need a primer on sed and regex, check out those links. Note, though, that sed doesn’t support extended regex.

If that wasn’t enough, I created some of my own:

Clean Ripped TV Episodes

The first one I wrote this weekend cleans up the metadata so they will sort and preview correctly on both iTunes/tv (which sort by Episode Number) and iPad/iPhone/iPod (which sort by Track Number). If you only want to go one way or the other, check out Copy Episode Number to Track Number or Copy Track Number to Episode Number

Track Name Clean Parts

…and the second one, that cleans up “Part n” signifiers at the end of a title, even the messy ones.

Proper English Title Caps 2

Cleans up the capitalization of the titles or other metadata in the track. I made this one a while back, updated from an existing script that didn’t handle a number of special cases. Needs to be updated to include better handling of capitalization after delimiters, but otherwise works pretty okay.

Monday
Aug162010

Apple Pro Keyboard disassembly and cleaning

The Apple Pro Keyboard is mushy and unresponsive, but worst of all, it traps and showcases dirt inside its clear plastic shell as if it were a disgusting work of art.

If you want to get back to your pristine-looking APK, it takes a fair amount of effort to take apart and clean. This guide should save you a bit of the stumbling around it takes to discover how to disassemble the thing, and let you get to the nitty-gritty, as it were.

You will need:

  • Surface cleaning solution (Formula 409, Windex Surface, or similar)
  • Paper towels, Q-tips and an old toothbrush
  • Small plastic bin with a watertight lid
  • Keycap-puller tool, or a plastic or nylon stick of some sort
  • #1 and #2 Philips screwdrivers
  • T5 Torx driver
  • Someplace to put the screws that you’ll remove, keeping them in order. Maybe a nice little segmented container.
  • Silicone grease

First, the APK in question:

Doesn’t look too terrible at this resolution, but trust me — up close, it looks positively horrid.

First, we’ll pop off the keys, and OH MY GOD WHAT THE HELL IS THAT.

Popping off the keys is very straightforward if you have a keycap-puller tool, but really any thin, flat blade can be used to pop ‘em off in a pinch. Just be careful about scratching up the case if you’re using a metal screwdriver or something like that. Once you have the keycaps off, you can also use the blade to pry off the three plastic rectangles that separate the function keys on the top row. Once you get under the edge, they pop off just like the keycaps do.

Toss them in the plastic bin, spritz ‘em with the surface cleaner, and let them soak for a few minutes. Maybe several. We’ll move on to separating the upper frame while those get all nice and soak-y.

To remove the upper frame, first flip the keyboard upside down and remove the four Torx/hex screws on the back, being careful to keep them in order (they’re two different lengths):

To be perfectly honest, they look like tiny hex, but the T5 Torx was the bit I had that worked. Let me know if you discover a better fit.

Turn the keyboard back over, and lift up on the top edge of the clear plastic frame, and gently wiggle the plastic clips free across the bottom edge of the keyboard.

Now, we can work on releasing the white middle bits from the acrylic sandwich. Remove the three tiny Philips screws from the middle of the keyboard (again they’re two different lengths, keep ‘em sorted):

Now to the two Philips screws that hold on the clear acrylic clamp around the USB cable:

Great! Now we’re ready to gently lift on the… Crap! There’s still another screw, isn’t there?

Turns out you need to need to punch a hole in the label on the back of your keyboard, here:

…to get at this screw:

This probably voids your warranty, but seeing as how any Apple Pro Keyboard is at least seven years old at this point, your warranty’s long over anyway. Still, if you void your warranty, break your keyboard, spill something horrible and sticky in it, and your computer explodes, it’s your own damn fault. Don’t come crying to me.

Now, we can finally lift up gently on the white bits in the middle (the USB “hub” ports may take a little individual nudging) and separate everything so we can really get at it.

The clear acrylic bits can withstand the surface cleaner straight up, but the white surface where the keycaps pop on needs an indirect touch. Spray a bit of cleaner on the toothbrush, and use that to scrub between all the nooks and crannies. You don’t want to spray it directly on, as then it may leak into the rubber membrane area where the keys press down, and you might gunk it up or short something out if it hasn’t dried before you plug things back in.

Use the Q-tips to get in the tight spots, and in the super-tight front edge of the upper frame where the clips are, I found a paper towel wrapped around the edge of a credit card lets you get in there and scrub.

Now, for the keycaps, add some hot tap water to the bin (just enough to cover the keys), put the lid on, and shake, shake, shake, Senora. That lid was water-tight, right?

Use towels (paper or otherwise) to wipe off the keycaps. The long soak and the agitation should have dislodged or loosened most of the oils and dirt that plague keyboards, but if there’s a particularly stubborn spot, feel free to take the toothbrush to the keycaps.

Re-assembly is the reverse of disassembly. Make sure everything’s dry before you start putting it back together. Put a little dab of silicone grease on the little metal wires where they touch the keycaps, and where they slot into the tabs on the white keyboard base.

Never looked better!

Well, okay… maybe the once, a decade ago, but this is pretty close.

Sunday
Aug152010

Make OS X re-run the initial Setup Assistant

When I’m prepping an old Mac to resell or give away, I like to install a clean system and apply all of the available updates first. Of course, I need to set up the Mac and create a user so I can log in and run installers, but then I want to clean it up and reset it so it will run the initial Setup Assistant on first run for the new user.

It seems like I’m constantly searching for the exact Terminal mojo to make this go, so here’s the trick. Next time I’ll only have to search my own web site. (This tip consolidated from these tips on Mac OS X Hints.)

  1. Boot into single-user mode (⌘-S during startup)
  2. Once the command-line prompt appears, type the following:

    mount -uw /
    rm -R /Library/Preferences/
    rm -R /Users/[username]/
    cd /private/var/db/netinfo
    mv local.nidb local.old
    rm ../.AppleSetupDone
    reboot
    
  3. OS X will restart and the setup assistant will launch automatically.

If you’re doing this to get the Mac ready for a new owner, just press ⌘-Q once the opening animation finishes, and click Shut Down. The Setup Assistant will automatically run the next time the Mac is started.

See also this tip on removing Classic cleanly. Sure, that old G4 iMac you’re giving to your niece can run Mac OS 9 apps, but do you really want to confuse her with the whole Mac OS 9 vs. X thing at this point? No. No, you don’t. Get rid of that Classic environment altogether. Trust me.

Wednesday
Aug112010

Drobo Rev1 Firmware Update Trick

I have an original first generation Drobo (USB only) that was not acting well lately. I was having some hanging and mounting issues, and on top of that, I couldn’t even get the firmware to update, which the Drobo folks were thinking might solve my other problems.

I tried updating the firmware automatically from Drobo Desktop, and I tried the manual firmware update process; nothing really worked. Well, it said it was working, but when it asked me to reboot the Drobo, it’s like it forgot the firmware update was even happening and asked me again if I’d like to upgrade. Le sigh.

So, after getting the helpful Drobo folks on the phone and being walked through the process, here’s what finally worked (this is assuming you’re on a Mac; the process might be slightly different on Windows):

  1. Download the latest firmware manually. As of this writing it’s 1.3.7.
  2. Mount the disk image (.dmg) you downloaded, and copy the file inside ending in .tdz to your desktop. (Again, as of now, it’s “Drobo_Firmware_1-3-7.tdz”.)
  3. Rename the extension on that file from .tdz to .zip, and click “Use .zip” if the Finder asks if you’re sure.
  4. Double-click to expand that .zip file, and inside the folder that appears, there will be two files, one ending in _rev1.tdf, and the other in _rev2.tdf. Take the _rev1 file (currently, the name is “v1.254.30359_rev1.tdf”) and move it to your desktop. Throw away everything else.
  5. Follow the Manual Firmware Update instructions for the 1st Gen Drobo, but instead of pointing it to the Drobo_Firmware_1-3-7.tdz file, point it to the v1.254.30359_rev1.tdf file you pulled out. Choose “Reboot Drobo now” when asked.

Seems that what was happening is that on the Rev1 Drobo, Drobo Desktop may not be chosing the right firmware update to apply, applying the Rev2 firmware, which of course doesn’t take, and the update fails. Pulling that Rev1 file out of the .zip file forces it to only consider the Rev1 update.

Special Thanks to Bryce D. of Drobo support for helping me solve this vexing problem!

Wednesday
Jul072010

Glyphish

Interesting way of funding the project and getting new buyers. Great bonuses at the $25 level, and the icons are well worth it.

Then again, it’s already overfunded, and everyone will get the original 130 icons free in August, if you just want to wait.