Optionally supply day of month

main
Bob Mottram 2020-02-22 14:54:46 +00:00
parent 2d9ceb21c4
commit 4e6a8c11a5
1 changed files with 5 additions and 2 deletions

View File

@ -3672,14 +3672,17 @@ def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumb
return events return events
def getTodaysEvents(baseDir: str,nickname: str,domain: str) -> {}: def getTodaysEvents(baseDir: str,nickname: str,domain: str,dayOfMonth=None) -> {}:
"""Retrieves calendar events for today """Retrieves calendar events for today
Returns a dictionary of lists containing Event and Place activities Returns a dictionary of lists containing Event and Place activities
""" """
now=datetime.now() now=datetime.now()
year=now.year year=now.year
monthNumber=now.month monthNumber=now.month
dayNumber=now.day if not dayOfMonth:
dayNumber=now.day
else:
dayNumber=dayOfMonth
calendarFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/calendar/'+str(year)+'/'+str(monthNumber)+'.txt' calendarFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/calendar/'+str(year)+'/'+str(monthNumber)+'.txt'
events={} events={}
if not os.path.isfile(calendarFilename): if not os.path.isfile(calendarFilename):