Heavens Above repository
April 29, 2012 at 11:30 PM by Dr. Drang
I’ve rewritten my scripts for adding ISS passes and Iridium flares to iCal. The scripts no longer use the deprecated appscript library to interact with iCal, relying instead on envoy, Kenneth Reitz’s module for running external programs. I’ve also stopped embedding the user’s Heaven’s Above login credentials in the script; the script now reads the login information from a dotfile in the user’s home directory.
Otherwise, the scripts work pretty much as they did before. I’ve put them into a GitHub repository to make it easier for others to get at them. Here’s the repository’s README:
These two scripts,
iridium-calendar
andiss-calendar
, scrape satellite viewing information from the Heavens Above website and add it to iCal. Their purpose is to give you notice of good satellite viewing opportunities (weather permitting).Both scripts require
- That you are a registered Heavens Above user with a username and password.
- That you have set an observing site (a latitude/longitude pair) at Heavens Above.
That you’ve created a
.heavens-above
dotfile in your home directory. The contents of the file should consist of one line of text with your username and password, separated by a colon. For example:drdrang:p455w0rd
A single
.heavens-above
dotfile works for both scripts.- Two non-standard Python libraries: Kenneth Reitz’s envoy, and Crummy Software’s Beautiful Soup.
The
iridium-calendar
script gets a week’s worth of Iridium satellite flares. These are brief, bright reflections off the polished antennas of one of the 66 Iridium communications satellites.The
iss-calendar
script gets a week’s worth of International Space Station passes. These are bright but otherwise conventional satellite passes that last a few minutes.Each script has a personalization section in which the user can set parameters that filter out less interesting (e.g., less bright) events and can tell the script which iCal calendar to put the notices in.
An alarm is set for 15 minutes before the event, giving the user time to get outside.
The scripts are intended to be run automatically each week via OS X’s launchd mechanism or cron.
If you simply want a list of the next week’s worth of events, you can run the scripts from the command line with the
-p
option. This will print the dates, times, location, and brightness for each event, one per line.
I used Peter Berg’s Lingon 3 to configure launchd to run the scripts automatically every week. It’s not horrendously difficult to write a launchd plist file and install it via launchctl, but Lingon 3 is cheap at $3 and makes the process easy and nearly foolproof.