Skip to content

Commit

Permalink
Implement @talks2014 so we can watch rsinger rig the vote again
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Nov 20, 2013
1 parent d576ebf commit 3190ead
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions edsu-plugins/Assorted/plugin.py
Expand Up @@ -1202,7 +1202,8 @@ def _diebold_tallies(self, tally='', year=''):
'2010': '13',
'2011': '17',
'2012': '21',
'2013': '24'},
'2013': '24',
'2014': '28'},
'logo': {'2008': '6'}
}
try:
Expand All @@ -1213,6 +1214,7 @@ def _diebold_tallies(self, tally='', year=''):
vote_url = base_url + poll_number
from socket import setdefaulttimeout
setdefaulttimeout(60)
print poll_url
try:
json = urlopen(Request(poll_url, None, {'Accept': 'application/json'})).read()
except HTTPError, e:
Expand All @@ -1226,9 +1228,21 @@ def _diebold_tallies(self, tally='', year=''):
tallies = [(vote['title'], vote['score']) for vote in votes]
return tallies, vote_url

def talks2014(self, irc, msg, args):
"""
Gets tally of talk votes for 2014 conference
"""
try:
tallies, vote_url = self._diebold_tallies("talks", "2014")
except PollNotFoundException, pnfe:
irc.reply("Poll not found for talk votes in 2014: %s" % pnfe)
else:
irc.reply(('; '.join("%s [%s]" % t for t in tallies)).encode('utf-8'))
irc.reply("Voting link: %s" % vote_url)

def talks2013(self, irc, msg, args):
"""
Gets tally of talk votes for 2012 conference
Gets tally of talk votes for 2013 conference
"""
try:
tallies, vote_url = self._diebold_tallies("talks", "2013")
Expand Down Expand Up @@ -2074,4 +2088,9 @@ def schmipsum(self, irc, msg, args, source, length):
irc.reply(ipsum.encode('utf8'))

schmipsum = wrap(schmipsum, [('literal',('shakespeare','bible','jane_austen','lewis_carroll','patents','nixon_tapes','college_essays','mission_statements','beatrix_potter','frankenstein')), 'int'])

def tank(self, irc, msg, args):
lines = (u'░░░░░███████ ]▄▄▄▄▄▄▄▄ ',u'▂▄▅█████████▅▄▃▂ ☻/',u'l██████████████████]. /▌',u'◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤.. / \\')
[irc.reply(line.encode('utf8'), prefixNick=False) for line in lines]

Class = Assorted

0 comments on commit 3190ead

Please sign in to comment.