コード例 #1
0
def force_check_room_status(room_name, force_reload):
    """ Reload event data from Google Calendar.  """

    if config.rooms.get(room_name):
        # print "000000", config.rooms.get(room_name).get('id')
        events = cal_resource.get_cal_feed(config.rooms.get(room_name).get('id'))
    else:
        events = []

    cal_resource.save_room_data(room_name, events)

    # print events

    return render_template('force_results.html', status=room_name)
コード例 #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Cron to reload events from Google Calendar.
"""

import cal_resource
import config

if __name__ == '__main__':
    """
    Reload data for all rooms. Loop over each room.
    Get events from Google calendar and save to data file.
    """

    for room in config.rooms:
        print "Reloading events for", room
        events = cal_resource.get_cal_feed(config.rooms.get(room).get('id'))
        cal_resource.save_room_data(room, events)