messageboard-2020-08-06-2133.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









238239240241242243244245246247248249250251252253254255256257           258259260261262263264265266267268269270271272273274275276277








51285129513051315132513351345135513651375138513951405141514251435144514551465147 51485149515051515152515351545155515651575158515951605161516251635164516551665167











                            <----SKIPPED LINES---->




GPIO_FAN = (
    27,
    'ERROR: RPi above %dC degrees' % TEMP_FAN_TURN_ON_CELSIUS,
    'SUCCESS: RPi below %dC degrees' % TEMP_FAN_TURN_OFF_CELSIUS,
    7, 'Thermal condition', False)

# for future expansion
GPIO_UNUSED_1 = (
    5,
    'Undefined condition set to true',
    'Undefined condition set to false',
    6, 'Unused', False)
GPIO_UNUSED_2 = (
    6,
    'Undefined condition set to true',
    'Undefined condition set to false',
    8, 'Unused', False)

# GPIO pushbutton connections - (GPIO pin switch in; GPIO pin LED out)
GPIO_SOFT_RESET = (20, 21)












#if running on raspberry, then need to prepend path to file names
if RASPBERRY_PI:
  PICKLE_FLIGHTS = MESSAGEBOARD_PATH + PICKLE_FLIGHTS
  PICKLE_DASHBOARD = MESSAGEBOARD_PATH + PICKLE_DASHBOARD
  LOGFILE = MESSAGEBOARD_PATH + LOGFILE
  PICKLE_DUMP_JSON_FILE = MESSAGEBOARD_PATH + PICKLE_DUMP_JSON_FILE
  PICKLE_FA_JSON_FILE = MESSAGEBOARD_PATH + PICKLE_FA_JSON_FILE
  PICKLE_SCREENS = MESSAGEBOARD_PATH + PICKLE_SCREENS
  CODE_REPOSITORY = MESSAGEBOARD_PATH

  HISTOGRAM_CONFIG_FILE = WEBSERVER_PATH + HISTOGRAM_CONFIG_FILE
  CONFIG_FILE = WEBSERVER_PATH + CONFIG_FILE
  ROLLING_MESSAGE_FILE = WEBSERVER_PATH + ROLLING_MESSAGE_FILE
  ALL_MESSAGE_FILE = WEBSERVER_PATH + ALL_MESSAGE_FILE
  ROLLING_LOGFILE = WEBSERVER_PATH + ROLLING_LOGFILE
  STDERR_FILE = WEBSERVER_PATH + STDERR_FILE
  BACKUP_FILE = WEBSERVER_PATH + BACKUP_FILE
  SERVICE_VERIFICATION_FILE = WEBSERVER_PATH + SERVICE_VERIFICATION_FILE
  UPTIMES_FILE = WEBSERVER_PATH + UPTIMES_FILE




                            <----SKIPPED LINES---->




    # then we need to
    # 1) update the histograms.php file with the correct file links, and
    # 2) delete the images that are now obsolete.
    epoch_string = EpochDisplayTime(time.time(), '%Y%m%d_%H%M%S_')

    ImageHistograms(
        flights,
        histogram_settings['histogram'],
        histogram_settings['histogram_history'],
        filename_prefix=HISTOGRAM_IMAGE_PREFIX + epoch_string,
        heartbeat=heartbeat)
    histogram_id_sequence = [
        'origin', 'destination',
        'day_of_month', 'day_of_week', 'hour',
        'bearing', 'distance', 'speed', 'vert_rate', 'altitude',
        'airline', 'aircraft', 'aircraft_length']
    path = WEBSERVER_PATH + WEBSERVER_IMAGE_RELATIVE_FOLDER
    files = os.listdir(path)
    lines = [
        '<head>',

        '  <title>Flight Tracker: Histograms</title>',
        '  <meta content="text/html; charset=UTF-8" http-equiv="content-type">',
        '  <meta name="viewport" content="width=device-width,initial-scale=1">',
        '</head>',
        '<body>',
        '<?php include "nav.html" ?>',
        '<div class="resp-iframe">'
    ]
    open_image = (
        '<div class="content-cap-holder">\n'
        '  <div class="image-box"'
        'style="max-width:900px;min-width:300px;width:100%;">\n'
        '    <figure>\n')
    close_image = ('</figure>\n'
                   '  </div>\n'
                   '    </div>\n')
    for histogram_id in histogram_id_sequence:
      pattern = re.compile('histogram[0-9_]*%s.png' % histogram_id)
      matching_files = sorted(
          [f for f in files if pattern.match(f)])




                            <----SKIPPED LINES---->





01234567890123456789012345678901234567890123456789012345678901234567890123456789









238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288








51395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179











                            <----SKIPPED LINES---->




GPIO_FAN = (
    27,
    'ERROR: RPi above %dC degrees' % TEMP_FAN_TURN_ON_CELSIUS,
    'SUCCESS: RPi below %dC degrees' % TEMP_FAN_TURN_OFF_CELSIUS,
    7, 'Thermal condition', False)

# for future expansion
GPIO_UNUSED_1 = (
    5,
    'Undefined condition set to true',
    'Undefined condition set to false',
    6, 'Unused', False)
GPIO_UNUSED_2 = (
    6,
    'Undefined condition set to true',
    'Undefined condition set to false',
    8, 'Unused', False)

# GPIO pushbutton connections - (GPIO pin switch in; GPIO pin LED out)
GPIO_SOFT_RESET = (20, 21)

GOOGLE_ANALYTICS_TAG = (
    '<!-- Global site tag (gtag.js) - Google Analytics -->\n'
    '<script async src="https://www.googletagmanager.com/gtag/'
    'js?id=UA-99931533-2"></script>\n'
    '<script>\n'
    '  window.dataLayer = window.dataLayer || [];\n'
    '  function gtag(){dataLayer.push(arguments);}\n'
    "  gtag('js', new Date());\n"
    "  gtag('config', 'UA-99931533-2');\n"
    '</script>\n')

#if running on raspberry, then need to prepend path to file names
if RASPBERRY_PI:
  PICKLE_FLIGHTS = MESSAGEBOARD_PATH + PICKLE_FLIGHTS
  PICKLE_DASHBOARD = MESSAGEBOARD_PATH + PICKLE_DASHBOARD
  LOGFILE = MESSAGEBOARD_PATH + LOGFILE
  PICKLE_DUMP_JSON_FILE = MESSAGEBOARD_PATH + PICKLE_DUMP_JSON_FILE
  PICKLE_FA_JSON_FILE = MESSAGEBOARD_PATH + PICKLE_FA_JSON_FILE
  PICKLE_SCREENS = MESSAGEBOARD_PATH + PICKLE_SCREENS
  CODE_REPOSITORY = MESSAGEBOARD_PATH

  HISTOGRAM_CONFIG_FILE = WEBSERVER_PATH + HISTOGRAM_CONFIG_FILE
  CONFIG_FILE = WEBSERVER_PATH + CONFIG_FILE
  ROLLING_MESSAGE_FILE = WEBSERVER_PATH + ROLLING_MESSAGE_FILE
  ALL_MESSAGE_FILE = WEBSERVER_PATH + ALL_MESSAGE_FILE
  ROLLING_LOGFILE = WEBSERVER_PATH + ROLLING_LOGFILE
  STDERR_FILE = WEBSERVER_PATH + STDERR_FILE
  BACKUP_FILE = WEBSERVER_PATH + BACKUP_FILE
  SERVICE_VERIFICATION_FILE = WEBSERVER_PATH + SERVICE_VERIFICATION_FILE
  UPTIMES_FILE = WEBSERVER_PATH + UPTIMES_FILE




                            <----SKIPPED LINES---->




    # then we need to
    # 1) update the histograms.php file with the correct file links, and
    # 2) delete the images that are now obsolete.
    epoch_string = EpochDisplayTime(time.time(), '%Y%m%d_%H%M%S_')

    ImageHistograms(
        flights,
        histogram_settings['histogram'],
        histogram_settings['histogram_history'],
        filename_prefix=HISTOGRAM_IMAGE_PREFIX + epoch_string,
        heartbeat=heartbeat)
    histogram_id_sequence = [
        'origin', 'destination',
        'day_of_month', 'day_of_week', 'hour',
        'bearing', 'distance', 'speed', 'vert_rate', 'altitude',
        'airline', 'aircraft', 'aircraft_length']
    path = WEBSERVER_PATH + WEBSERVER_IMAGE_RELATIVE_FOLDER
    files = os.listdir(path)
    lines = [
        '<head>',
        GOOGLE_ANALYTICS_TAG,
        '  <title>Flight Tracker: Histograms</title>',
        '  <meta content="text/html; charset=UTF-8" http-equiv="content-type">',
        '  <meta name="viewport" content="width=device-width,initial-scale=1">',
        '</head>',
        '<body>',
        '<?php include "nav.html" ?>',
        '<div class="resp-iframe">'
    ]
    open_image = (
        '<div class="content-cap-holder">\n'
        '  <div class="image-box"'
        'style="max-width:900px;min-width:300px;width:100%;">\n'
        '    <figure>\n')
    close_image = ('</figure>\n'
                   '  </div>\n'
                   '    </div>\n')
    for histogram_id in histogram_id_sequence:
      pattern = re.compile('histogram[0-9_]*%s.png' % histogram_id)
      matching_files = sorted(
          [f for f in files if pattern.match(f)])




                            <----SKIPPED LINES---->