main
Bob Mottram 2020-02-23 09:42:09 +00:00
parent 09e9ff5616
commit f0f818197e
1 changed files with 42 additions and 33 deletions

View File

@ -192,6 +192,7 @@ def thisWeeksEventsCheck(baseDir: str,nickname: str,domain: str) -> bool:
def getThisWeeksEvents(baseDir: str,nickname: str,domain: str) -> {}:
"""Retrieves calendar events for this week
Returns a dictionary indexed by day number of lists containing Event and Place activities
Note: currently not used but could be with a weekly calendar screen
"""
now=datetime.now()
year=now.year
@ -275,7 +276,8 @@ def getThisWeeksEvents(baseDir: str,nickname: str,domain: str) -> {}:
return events
def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumber: int) -> {}:
def getCalendarEvents(baseDir: str,nickname: str,domain: str, \
year: int,monthNumber: int) -> {}:
"""Retrieves calendar events
Returns a dictionary indexed by day number of lists containing Event and Place activities
"""
@ -291,12 +293,18 @@ def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumb
postFilename=locatePost(baseDir,nickname,domain,postId)
if not postFilename:
recreateEventsFile=True
else:
continue
postJsonObject=loadJson(postFilename)
if postJsonObject:
if postJsonObject.get('object'):
if isinstance(postJsonObject['object'], dict):
if postJsonObject['object'].get('tag'):
if not postJsonObject:
continue
if not postJsonObject.get('object'):
continue
if not isinstance(postJsonObject['object'], dict):
continue
if not postJsonObject['object'].get('tag'):
continue
postEvent=[]
dayOfMonth=None
for tag in postJsonObject['object']['tag']:
@ -318,6 +326,7 @@ def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumb
else:
# tag is a place
postEvent.append(tag)
if postEvent and dayOfMonth:
calendarPostIds.append(postId)
if not events.get(dayOfMonth):