Airfoil FTW

airfoil-mac@2x.png

Not sure how I missed out on this, but I Just discovered Airfoil for OSX and the companion iOS app Airfoil Speakers. This is a pretty fantastic app duo, allowing me to stream music from my Mac to an old unused iPhone which is connected to the stereo in my office without a physical connection. The audio quality is very nice, with only a second or so delay from the time that I change tracks, pause, etc.

Screen Shot 2015-11-11 at 3.11.09 PM.png

Making Colloquy IRC logs more friendly

If you’ve ever logged anything in “human readable” format from the OSX IRC client Colloquy, you’re probably used to seeing the logfiles in XML format, similar to this:

(click here for a more readable format)

  <event id="XXXXXXXXXXX" name="memberNewNickname" occurred="2013-01-02 12:00:00 -0500">
    <message>user1 is now known as <span class="member">user1|afk</span>.</message>
    <old>user1</old>
    <who hostmask="user1@X">user1</who>
  </event>

Not bad when there’s only a few entries, but with multiple logfiles containing thousands of entries each, it can chew up time and eat away at system resources. Wouldn’t it be nice if it looked more like this?

[12:00pm] user1 is now known as user1|afk.

Well, tonight I needed to go back and look for something in an old log, and parsing through the format of the log made it difficult to do with a simple grep command (note: I said simple). After some poking around I ran across a pretty simple, yet elegant solution: xsltproc.

From the project description: “It takes as first argument the path or URL to an XSLT stylesheet, the next arguments are filenames or URIs of the inputs to be processed. The output of the processing is redirected on the standard output.“. Yep, that’s what we need.

I found a pretty good PlainText.xsl file in a Google cache copy of a defunct add-ons page for Colloquy (it could use some improvements though, it only displays the time – no date. I’ll work on that), you can grab it here.

xsltproc /path/to/PlainText.xsl /path/to/channel.colloquyTranscript

The result? A nicely displayed logfile.

Happy Parsing.