main2
Bob Mottram 2019-10-11 19:48:46 +01:00
parent ffc949406d
commit e378e83a8a
1 changed files with 18 additions and 15 deletions

View File

@ -2784,21 +2784,24 @@ def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumb
postEvent=[] postEvent=[]
dayOfMonth=None dayOfMonth=None
for tag in postJsonObject['object']['tag']: for tag in postJsonObject['object']['tag']:
if tag.get('type'): if not tag.get('type'):
if tag['type']=='Event' or tag['type']=='Place': continue
if tag['type']=='Event': if tag['type']!='Event' and tag['type']!='Place':
# tag is an event continue
if tag.get('startTime'): if tag['type']=='Event':
eventTime= \ # tag is an event
datetime.strptime(tag['startTime'], \ if not tag.get('startTime'):
"%Y-%m-%dT%H:%M:%S%z") continue
if int(eventTime.strftime("%Y"))==year and \ eventTime= \
int(eventTime.strftime("%m"))==monthNumber: datetime.strptime(tag['startTime'], \
dayOfMonth=str(int(eventTime.strftime("%d"))) "%Y-%m-%dT%H:%M:%S%z")
postEvent.append(tag) if int(eventTime.strftime("%Y"))==year and \
else: int(eventTime.strftime("%m"))==monthNumber:
# tag is a place dayOfMonth=str(int(eventTime.strftime("%d")))
postEvent.append(tag) postEvent.append(tag)
else:
# tag is a place
postEvent.append(tag)
if postEvent and dayOfMonth: if postEvent and dayOfMonth:
calendarPostIds.append(postId) calendarPostIds.append(postId)
if not events.get(dayOfMonth): if not events.get(dayOfMonth):