When I Enter the Office, the Imperial March Plays

Jon Yurek

A long time ago in an office far, far away… robot wars! I mean, budget surplus! We had a bit extra in the budget a while back and so we did what any responsible business owners would have done: ask the employees what they wanted us to spend it on. Here’s the list we got back:

  • A fully glass floor so I can watch the people below me
  • Currency valid only on Dean Kamen’s personal island
  • A pony
  • RFID door key that plays my ‘theme’ when I enter the office.
  • 10 pounds of green M&Ms
  • Portal gun from Half-life Portal so we can use the gun to create hole between tb kitchen and my kitchen - It’ll be great we can have toast.

Right. Well, there was one thing on there that was actually possible (besides the M&Ms), and it was the RFID theme song system. That’s not something you buy off the shelf, and since it was a budget surplus and not a time surplus, we shelved that. Time comes for us to move into our current office and, lo and behold, there’s an RFID door-lock system! But, you know, no theme songs. Well, since we were still busy it took a while, but I finally contacted the manufacturer of the system and managed to get an API and documentation (since it’s not publicly available, for whatever reason—if you want to get it, email their support).


Gentlemen, behold

Now, I tap my card to the reader: the door opens and my theme song plays! (Full disclosure: I lied in the title. My theme isn’t the Imperial March. It’s part of TMBG’s Space Suit. But it used to be the Imperial March, so I don’t feel bad putting it in the title.)

The important part here is that the source is available on GitHub.

The original version was a bit of a spike, as it didn’t have tests. This current version is much better and has tests. We don’t feel comfortable using other people’s code if they don’t have tests; we also don’t feel right giving you code without tests.

It’s got a bunch of features, like reconnecting itself if you pull the cord out (theoretically) and only playing between certain hours, and, umm, working. Only playing between certain hours makes a big difference, because if you play all the time you’ll quickly get tired of it (and what’s the fun in that?). We have it set to only play between 6am and 11am, so it generally only plays when you first come in.

It only runs on Windows, because that’s how Crosspoint supplied the API. It accesses the COM objects via the WIN32OLE library, which is thankfully standard with Ruby. After a few media players I settled on Winamp 2.95 because it was the only one that actually started playing as soon as you ran the command, go figure.

Because not everyone at thoughtbot is in Boston, not everyone has a song yet, but here’s the current standing:

  • Jon: Space Suit
  • Matt: What’s My Name
  • Chad: Audience Cheering Live Album Intro
  • Mike: In the Air Tonight
  • Jason: Stardust Fanfare
  • Dan: I Don’t Feel Like Dancin’
  • Joe: Liberty Bell March
  • Nick: Limelight
  • Fred: Kernkraft 400

Note: If you happen to have an XM3 RFID door system and want to set this up, keep your music below 10 seconds or so, otherwise it gets really tedious really quickly.