Exemplo n.º 1
0
def readFromIcs(calendarPath):
    """
        Extract the event information from the calendarPath ics file and store the data in a days array
    """
    
    days = [dict() for i in range(5)]

    # Read data from .ics calendar
    with open(calendarPath, "rb") as f:
        
        calendar = Calendar.from_ical(f.read())
        
        for component in calendar.walk():
            if component.name == "VEVENT":
                event = Event(component.get('summary'),
                                component.get('description'),
                                component.get('dtstart').dt,
                                component.get('dtend').dt,
                                component.get('location'))

                #days[event.start.weekday()][int(event.start.hour)] = event
                days[event.start.weekday()][event.start.hour+event.start.minute / 100] = event
                event.description = ""      # Ignore description

    return days 
                        start=index,
                        timezone='UTC',
                        location=str(row['roadName']),
                        description=evntDescription,
                        event_id=evntString,
                        color=evntColor)

        print('ID before add:', event.event_id)
        ret_event = calendar.add_event(event)
        print('ID after add:', event.event_id, 'Returned event ID:',
              ret_event.event_id)

    else:

        print('-Updating event: ', index, row['name'], row['tags'], evntString)

        event = row['event_obj']

        event.summary = evntSummary
        event.description = evntDescription

        calendar.update_event(event)

# %%
df.loc[df['signUps'] > 9]

# %%
df.loc[df['name'].str.startswith('Wacky Races')]

# %%