コード例 #1
0
ファイル: ss.py プロジェクト: WraithCadmus/irccat-commands
  (2012,  3,  1): ('Warmongers', 'Gunmakers', 'EC1R 5ET'),
  (2012,  3, 29): ('Blue Marlin', 'The Fellow', 'N1 9AA'),
  (2012, 10,  4): ('Kernel Panic', 'The Old Fountain', 'EC1V 9NU'),
  (2012, 11, 29): ('Shipping Forecast', 'The Ship Tavern', 'WC2A 3HP'),
  (2014,  6, 19): ('Calendar', 'Bricklayers Arms', 'W1T 1QS'),
  (2014,  7, 31): ('Parklife', 'Regents Park', 'NW1 4NR'),
  (2015,  2, 26): ('How Do I Even', 'Cask Pub & Kitchen', 'SW1V 2EE'),
  (2015, 12, 15): ('Decimalisation', 'UNKNOWN', 'London'),
  (2016,  4,  1): ('Corked', 'The Winemakers Club', 'EC4A 4AN'),
}

def next_meet(fromd):
  fromd = fromd.year, fromd.month, fromd.day
  future = [d for d in dates if d >= fromd]
  if not future:
    return None
  return date(*min(future))

start, end = nextevent.get(next_meet, '18:00')

name, venue, postcode = dates[(start.year, start.month, start.day)]

print 'Substandards %s: %s at %s, %s (%s until beer!)' % (
  name,
  nextevent.date_nice(start),
  venue,
  postcode,
  nextevent.untilmsg(start),
)

コード例 #2
0
ファイル: dc.py プロジェクト: WraithCadmus/irccat-commands
    (2016, 10, 25),
    (2016, 11, 29),
]

if __name__ == '__main__':

    from dctalks import get_future_events, talk_getter
    from nextevent import date_nice, untilmsg

    start, end = nextevent.get(dates, '19:30')
    events = get_future_events()

    msg = "No talks yet! Email [email protected] if you'd like to give one."
    msg = "No talks yet!"
    matching_events = [(s, e) for s, e in events if s.date() == start.date()]
    if matching_events:
        event_start, event = matching_events[0]
        talks = list(talk_getter(event))
        if len(talks) == 1:
            msg = "One talk so far. Email [email protected] if you'd like to give the other."
            msg = "One talk so far!"

        elif len(talks) > 1:
            msg = "Type ?dctalks for a list of talks."

    print 'Next monthly meeting: %s (%s until beer!). %s' % (
        date_nice(start),
        untilmsg(start),
        msg,
    )
コード例 #3
0
ファイル: votes.py プロジェクト: WraithCadmus/irccat-commands
#!/usr/bin/env python
import requests
import nextevent
import datetime

#response = requests.get('http://www.opavote.com/api/elections/6555796884160512/n-votes')
response = requests.get('http://www.opavote.com/api/elections/6120523440324608/n-votes')
votes = int(response.content)

total = 1228

voting_ends = datetime.datetime(2016, 12, 4, 0, 0)
if voting_ends > datetime.datetime.now():
    end = nextevent.untilmsg(voting_ends).lower()

    print "%s votes cast (%i%% of membership). Voting closes in %s." % (votes, (100.0/total)*votes, end)
コード例 #4
0
ファイル: dc.py プロジェクト: londonhackspace/irccat-commands
  (2016, 11, 29),
]

if __name__ == '__main__':

    from dctalks import get_future_events, talk_getter
    from nextevent import date_nice, untilmsg

    start, end = nextevent.get(dates, '19:30')
    events = get_future_events()

    msg = "No talks yet! Email [email protected] if you'd like to give one."
    msg = "No talks yet!"
    matching_events = [(s, e) for s, e in events if s.date() == start.date()]
    if matching_events:
        event_start, event = matching_events[0]
        talks = list(talk_getter(event))
        if len(talks) == 1:
            msg = "One talk so far. Email [email protected] if you'd like to give the other."
            msg = "One talk so far!"

        elif len(talks) > 1:
            msg = "Type ?dctalks for a list of talks."

    print 'Next monthly meeting: %s (%s until beer!). %s' % (
      date_nice(start),
      untilmsg(start),
      msg,
    )

コード例 #5
0
ファイル: votes.py プロジェクト: detobate/irccat-commands
#!/usr/bin/env python
import requests
import nextevent
import datetime

response = requests.get('http://www.opavote.com/api/elections/6555796884160512/n-votes')
votes = int(response.content)

total = 1251

voting_ends = datetime.datetime(2015, 11, 29, 21, 0)
if voting_ends > datetime.datetime.now():
    end = nextevent.untilmsg(voting_ends).lower()

    print "%s votes cast (%i%% of membership). Voting closes in %s." % (votes, (100.0/total)*votes, end)