예제 #1
0
파일: device.py 프로젝트: JohanRoland/CarAI
 def perform(self,day):
     days = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]
     weekday = days.index(day)
     tnow = datetime.now()
     daysahead = weekday - tnow.weekday()
     if daysahead <= 0: 
       daysahead += 7
     date = tnow + timedelta(daysahead)
     date = date.replace(hour=0,minute=0,second=0)
     evs = getEvent(1,date)
     outstring = ""
     c = 0
     for es in evs:
       ev = parseCal(es)
       #ev = parseCal(getNextEvent(1))
       #timeLeft = formatDateDiff(ev[1],datetime.now())
       timeofday = ev[1].strftime('%H:%M')
       if c == len(evs) -1:
         outstring += ev[0] + " at " + timeofday 
       else: 
         outstring += ev[0] + " at " + timeofday + "and " 
       c = c+1
     event = {
         "grammar_entry":outstring
     }
     return [event]
예제 #2
0
파일: device.py 프로젝트: JohanRoland/CarAI
 def perform(self):
     ev = parseCal(getNextEvent(1))
     timeLeft = formatDateDiff(ev[1],datetime.now())
     event = {
         "grammar_entry": (ev[0] + timeLeft)
     }
     return [event]