Flight schedules to iCal? Done!

I travel a lot (too much).  As such, my favorite airline (Southwest) has become the proverbial company bus.  Actually, that’s not really in any proverb, but you know what I mean.

Anyway, I travel often enough that the process of purchasing flights, placing them in my calendar, and scheduling the ‘Flight Status Updates’ gets a little tedious and error prone.  Apparently at one time southwest provided the option of placing the flight in a iCal file, but it went away with a recent website update. What to do?  Geek it?

Here’s my solution:

Southwest sends an email with your itinerary in a psuedo-pretty XML format when you purchase a trip.  I use procmail to filter my incoming mail and southwest.com email gets put in it’s own special ‘folder’.  I recently added a simple bash script to ‘grep’ the contents of this folder and extract relevant itinerary information.  The script is executed directly by procmail.

The output of the script is a CSV format text file that is accessible by a php script executed by apache.  This script takes the text file, munges it with some information about the airport location and DST and arrives at a starting and ending time of the flight.  This is output via iCalcreator as an iCal format file that your favorite calendar program can handle (right?)

Download here

There are a number of dependencies.  See the README file for them all