Hi Phil,

While I was compiling 2.13.62, I bashed out a quick script to parse
bug-lilypond emails.  Results for 2011 are here:
http://lilypond.org/~graham/maybe-missing-emails.html

Lots of bad style, missing features, etc -- but I think it's already
useful enough to give an overview of the situation.  Hopefully
somebody (maybe even you? :)   will be inspired by this idea and will
continue work on the script.

Cheers,
- Graham

PS I think we need to give an award of some sorts to Dmytro and Ralph;
their names show up quite frequently in the "give a late reply to
emails that got lost" list.  Remember, the names in the yellow and red
sections are not the names of the people who should have answered the
emails; they're the names of people who stepped forward to do extra
work!
#!/usr/bin/env python

import sys
import mailbox
import email
import datetime

try:
	mbox_filename = sys.argv[1]
except:
	# to create combined.mbox:
	# - download files from ftp://lists.gnu.org/bug-lilypond/
	# - cat 2011-04 2011-05 > combined.mbox
	mbox_filename = "combined.mbox"

# TODO: only count replies from Bug Squad members as official
# TODO: add summary at top of page?

initial_emails = []
for message in mailbox.mbox(mbox_filename):
	# ignore automatic emails from googlecode.
	if message['from'].startswith('lilyp...@googlecode.com'):
		continue
	# ignore replies to previous emails
	if message['references'] or message['subject'].startswith("Re:"):
		continue
	# everything else should get a response
	initial_emails.append(message)

less_24_hours = []
less_48_hours = []
late_answer = []
never_answer = []

for question in initial_emails:
	# look for a response
	replied = False
	for message in mailbox.mbox(mbox_filename):
		if message['references']:
			if message['references'].find(question['message-id']) >= 0:
				# ick, sorry
				question_date = datetime.datetime(*(
					email.utils.parsedate(question['date'])[:-2]))
				answer_date = datetime.datetime(*(
					email.utils.parsedate(message['date'])[:-2]))
				delta = answer_date - question_date
				if delta < datetime.timedelta(hours=24):
					less_24_hours.append( (question, message) )
				elif delta < datetime.timedelta(hours=48):
					less_48_hours.append( (question, message) )
				else:
					late_answer.append( (question, message) )
				replied = True
				break
	if not replied:
		never_answer.append( (question) )

def write_table(html_file, message, emails, color):
	html_file.write("<h3>%s</h3>\n" % message)
	html_file.write("<table border=\"1\">")
	html_file.write("<tr><th> Initial email </th><th></th><th></th><th> Answer </th></tr>")
	if len(emails[0]) == 2:
		for email, answer in emails:
			html.write("<tr><td> %s </td><td> %s </td><td> %s </td> <td bgcolor=\"%s\">%s</td></tr>" % (
				email['date'], email['subject'], email['from'], color, answer['from']
			))
	else:
		for email in emails:
			html.write("<tr><td> %s </td><td> %s </td><td> %s </td> <td bgcolor=\"%s\">%s</td></tr>" % (
				email['date'], email['subject'], email['from'], color, "NOBODY"
			))
	html.write("</table>")


html = open('maybe-missing-emails.html', 'w')
html.write("<html><head></head><body>\n")

write_table(html, "Less than 24 hours", less_24_hours, "green")
write_table(html, "Less than 48 hours", less_48_hours, "yellow")
write_table(html, "Late replies", late_answer, "red")
write_table(html, "Never replied", never_answer, "black")

html.write("</body></html>")
html.close()


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to