summaryrefslogtreecommitdiff
path: root/userparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'userparse.py')
-rwxr-xr-xuserparse.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/userparse.py b/userparse.py
new file mode 100755
index 0000000..41d4d3d
--- /dev/null
+++ b/userparse.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python2
+
+import sys, datetime
+from pylab import *
+
+for fn in sys.argv[1:]:
+ f = open(fn, 'r')
+ channel = f.readline().strip().rsplit('/')[-1]
+ nick = f.readline().strip()
+
+ if channel.startswith('#'):
+ channel = channel[1:]
+
+ print('Graphing activity for {0} in #{1}'.format(nick, channel))
+
+ data = sorted(([int(y) for y in x.strip().split(',')] for x in f), key = lambda x: int(x[0]))
+ f.close()
+
+ fig = figure(figsize=(30, 6))
+ ax = fig.gca()
+ ax.xaxis.set_major_locator(MonthLocator(range(3, 13, 3)))
+ ax.xaxis.set_major_formatter(DateFormatter('%b %Y'))
+ grid(1)
+ xlabel('Time')
+ ylabel('Lines/day')
+ title('Activity for {0} in #{1}'.format(nick, channel))
+ bar([datetime.date.fromtimestamp(x[0]) for x in data], [sum(x[1:]) for x in data])
+
+ savefig('{0}-{1}.png'.format(channel, nick))