def main():
    global election_results
    election_results = results.fresh_data()
    #election_results['Vermont'] = {'summary': 'test'}

    keep_running = True
    while keep_running:
        print 'Starting campfire process'
        p = multiprocessing.Process(target=manage_campfire)
        p.start()
        p.join()
        if p.exitcode == 1:
            keep_running = False
            print 'Not restarting campfire process'
        else:
            import time
            time.sleep(3)
    print 'Terminating'
    return 0
def do_election_updates(room):
    global election_results

    print 'Checking feed...'
    update = results.fresh_data()

    changes = []

    states = update.keys()
    states.sort()
    for state in states:
        if (update[state] is not None) and (
                election_results[state] is None or
                election_results[state]['summary'] !=
                update[state]['summary']):
            changes.append(update[state]['summary'])
            election_results[state] = update[state]
    if len(changes):
        room.paste('\n'.join(changes))

    # Start a new timer
    t = threading.Timer(900, do_election_updates, args=(room,))
    t.start()