Пример #1
0
        global main_log
        live_api = liveapi.Elemental_api(cf.elemental_ip)
        try:
            response = live_api.list_live_events()
            if response.status_code != 200:
                raise Exception("Elemental server error: {}".format(
                    response.status_code))
        except Exception as e:
            main_log.error('Error: {}'.format(e))

    # Set-up state manager

    # Make a new dict with GPIs as Keys and (class)StreamAvailCtrl as values
    # Check wether last exit was from reload and load state if necessary
    gpi_event_dict = {}
    if stater.is_last_exit_from_reload() is True:
        gpi_cue_state = stater.load_gpi_state()
        main_log.info('Last exit: Reload')

        for gpi, id in cf.gpi2stream.items():
            try:
                gpi_event_dict[gpi] = StreamAvailCtrl(gpi, id, cf.elemental_ip,\
                    in_cue = gpi_cue_state[gpi])
            except KeyError as e:
                main_log.info(
                    "GPIO input changed: Neglecting old state and loading entirely from config file"
                )
                for gpi, id in cf.gpi2stream.items():
                    gpi_event_dict[gpi] = StreamAvailCtrl(gpi, id, cf.elemental_ip,\
                        lock_interval=cf.min_av_dur)