Created
September 30, 2009 11:22
-
-
Save JNRowe/198018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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