#!/usr/bin/env python import nextevent dates = [(2013, 5, 5)] start, end = nextevent.get(dates, "10:00") nextevent.printmsg("Boat thingy", "booze", start)
#!/usr/bin/env python import nextevent dates = [ (2011, 11, 30), (2011, 12, 28), (2012, 1, 25), (2012, 2, 29), (2012, 3, 28), (2012, 4, 25), ] start, end = nextevent.get(dates, '19:30') nextevent.printmsg('Next Science Museum lates', 'beer', start)
#!/usr/bin/env python import nextevent dates = [(year, 12, 25) for year in range(2011, 2031)] start, end = nextevent.get(dates, '00:00') nextevent.printmsg('Christmas day', 'presents', start)
#!/usr/bin/env python import nextevent dates = [ (2012, 1, 16), (2012, 1, 23), (2012, 1, 30), ] start, end = nextevent.get(dates, '20:00') nextevent.printmsg('Next Gadget Geeks', 'trolling', start)
(2014, 9, 30), (2014, 10, 28), (2014, 11, 25), (2014, 12, 15), (2015, 1, 27), (2015, 2, 24), (2015, 3, 31), (2015, 4, 28), (2015, 5, 26), (2015, 6, 30), (2015, 7, 28), (2015, 8, 25), (2015, 9, 29), (2015, 10, 27), (2015, 11, 24), (2016, 1, 26), (2016, 2, 23), (2016, 3, 29), (2016, 4, 26), (2016, 5, 31), (2016, 6, 28), (2016, 7, 26), (2016, 8, 30), (2016, 9, 27), (2016, 10, 25), (2016, 11, 29), ] start, end = nextevent.get(dates, '19:30') nextevent.printmsg('Next monthly meeting', 'beer', start)
#!/usr/bin/env python from datetime import timedelta import nextevent def next_meet(d): return d + timedelta(days=(4 - d.weekday()) % 7) try: start, end = nextevent.get(next_meet, '18:00', '23:00') except nextevent.EventInProgress: print 'Friday drinking is currently under way! Quick! Run to the pub!' else: nextevent.printmsg('Next Friday drinking', 'beer', start)
import nextevent dates = { (2012, 2, 2): ("Recrudescence", "Bricklayers Arms", "W1T 1QS"), (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"), } 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), )
(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), )
#!/usr/bin/env python import nextevent dates = [ (2015, 1, 6, 11, 20), # Dragon, scrubbed (2015, 1, 10, 9, 47), # Dragon (2015, 2, 8, 23, 10), # DSCOVR, scrubbed (2015, 2, 10, 23, 5), # DSCOVR (2015, 2, 17, 12, 0), # Eutelsat (2015, 3, 2, 3, 50), (2015, 6, 28, 15, 21), (2015, 12, 22, 1, 29), # ORBCOMM-2 ] start, end = nextevent.get(dates) nextevent.printmsg('Next SpaceX launch', 'liftoff', start)
#!/usr/bin/env python import nextevent dates = [ (2012, 12, 25), ] start, end = nextevent.get(dates, '17:15') nextevent.printmsg('Next Dr Who', 'teh fear', start)
#!/usr/bin/env python import nextevent dates = [(2012, 02, 10), (2013, 02, 8), (2014, 02, 10)] start, end = nextevent.get(dates, "19:30") nextevent.printmsg("Next Birthday", "beer", start)
#!/usr/bin/env python from datetime import timedelta import nextevent def next_meet(d): return d + timedelta(days=(1 - d.weekday()) % 7) try: start, end = nextevent.get(next_meet, '19:30', '22:30') except nextevent.EventInProgress: print 'The weekly meeting is currently under way! Quick! Run to the space!' else: nextevent.printmsg('Next weekly meeting', 'beer', start)