Skip to content

Instantly share code, notes, and snippets.

@JNRowe
Created September 30, 2009 11:22
Show Gist options
  • Save JNRowe/198018 to your computer and use it in GitHub Desktop.
Save JNRowe/198018 to your computer and use it in GitHub Desktop.
#! /usr/bin/python -tt
import ConfigParser
import datetime
import os
data = ConfigParser.ConfigParser()
data.read(os.path.expanduser("~/.abook/addressbook"))
birthdays = filter(lambda x: "custom2" in data.options(x),
data.sections())
print "# THIS FILE IS AUTOGENERATED FROM ABOOK DATA"
for record in birthdays:
try:
name = data.get(record, "nick")
except ConfigParser.NoOptionError:
name = data.get(record, "name")
birthdate = datetime.datetime.strptime(data.get(record, "custom2"),
"%Y-%m-%d")
print "REM %s +4 MSG %s's [grn][_yr_num(%d)][nrm] Birthday %%a" \
% (birthdate.strftime("%d %B"), name, birthdate.year)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment