示例#1
0
def init():
    global status, app_config, darkice_config

    lcd_display.info("...............\n...............")
    lcd_display.info("server\nstarting up")
    status = []

    lcd_display.info("loading\nconfig file")
    app_config_file = open(path.join('config', 'pi_stream.ini'))
    app_config.clear()
    app_config, app_config_parser_errors = parse_app_config(app_config_file)
    app_config_file.close()

    if len(app_config_parser_errors) != 0:
        status.append(app_config_parser_errors)

    if len(app_config) != 0:  # no errors
        lcd_display.info("loading default/\ndarkice config")
        darkice_config_file = open(app_config['defaultConfig'])
        darkice_config, darkice_config_parser_errors = config.init_config(
            darkice_config_file)
        darkice_config_file.close()

        if len(darkice_config_parser_errors) != 0:
            status.append(darkice_config_parser_errors)

    lcd_display.info("running\nstatus tests")
    status = run_all_tests()
    lcd_display.start_process()
    try:
        ip_address = get_ip_address('eth0')
        lcd_display.put(u"Reach me at\n{}".format(ip_address),
                        lcd_display.GOOD)
    except Exception as e:
        pass  # dont do anything, there will be an error in the queue anyway
    for item in status:
        if item['result'] is TestStatus.Error:
            lcd_display.put(item['lcd_message'], lcd_display.ERROR)
        if item['result'] is TestStatus.Attention:
            lcd_display.put(item['lcd_message'], lcd_display.INFO)
        pass
示例#2
0
def init():
    global status, app_config, darkice_config

    lcd_display.info("...............\n...............")
    lcd_display.info("server\nstarting up")
    status = []

    lcd_display.info("loading\nconfig file")
    app_config_file = open(path.join('config', 'pi_stream.ini'))
    app_config.clear()
    app_config, app_config_parser_errors = parse_app_config(app_config_file)
    app_config_file.close()

    if len(app_config_parser_errors) != 0:
        status.append(app_config_parser_errors)

    if len(app_config) != 0:  # no errors
        lcd_display.info("loading default/\ndarkice config")
        darkice_config_file = open(app_config['defaultConfig'])
        darkice_config, darkice_config_parser_errors = config.init_config(darkice_config_file)
        darkice_config_file.close()

        if len(darkice_config_parser_errors) != 0:
            status.append(darkice_config_parser_errors)

    lcd_display.info("running\nstatus tests")
    status = run_all_tests()
    lcd_display.start_process()
    try:
        ip_address = get_ip_address('eth0')
        lcd_display.put(u"Reach me at\n{}".format(ip_address), lcd_display.GOOD)
    except Exception as e:
        pass # dont do anything, there will be an error in the queue anyway
    for item in status:
        if item['result'] is TestStatus.Error:
            lcd_display.put(item['lcd_message'], lcd_display.ERROR)
        if item['result'] is TestStatus.Attention:
            lcd_display.put(item['lcd_message'], lcd_display.INFO)
        pass
示例#3
0
def run_all_tests_http():
    global status
    status = run_all_tests()
    return get_status()
示例#4
0
def run_all_tests_http():
    global status
    status = run_all_tests()
    return get_status()