import os
import subprocess

import routines.config as config
import routines.helpers as helpers

def get_static_info():
    """ Outputs data concerning the computer in the C-AWS station
    """
    startup_time = None
    data_drive_space = None
    camera_drive_space = None
    
    # Get system startup time
    try:
        startup_time = (subprocess
            .check_output(["uptime", "-s"]).decode().rstrip())
    except: pass

    # Get data and camera drive space
    if config.load() == True:
        if os.path.isdir(config.data_directory):
            free_space = helpers.remaining_space(config.data_directory)

            if free_space != None:
                data_drive_space = round(free_space, 2)

        if (config.camera_directory != None and os.path.isdir(
            config.camera_directory) and os.path.ismount(
            config.camera_directory)):

            free_space = helpers.remaining_space(config.camera_directory)
            if free_space != None:
                camera_drive_space = round(free_space, 2)

    print(str(helpers.none_to_null(startup_time)) + "\n"
        + str(helpers.none_to_null(data_drive_space)) + "\n"
        + str(helpers.none_to_null(camera_drive_space)))
[((21, 7, 21, 20), 'routines.config.load', 'config.load', ({}, {}), '()', True, 'import routines.config as config\n'), ((22, 11, 22, 47), 'os.path.isdir', 'os.path.isdir', ({(22, 25, 22, 46): 'config.data_directory'}, {}), '(config.data_directory)', False, 'import os\n'), ((23, 25, 23, 71), 'routines.helpers.remaining_space', 'helpers.remaining_space', ({(23, 49, 23, 70): 'config.data_directory'}, {}), '(config.data_directory)', True, 'import routines.helpers as helpers\n'), ((28, 48, 29, 36), 'os.path.isdir', 'os.path.isdir', ({(29, 12, 29, 35): 'config.camera_directory'}, {}), '(config.camera_directory)', False, 'import os\n'), ((29, 41, 30, 36), 'os.path.ismount', 'os.path.ismount', ({(30, 12, 30, 35): 'config.camera_directory'}, {}), '(config.camera_directory)', False, 'import os\n'), ((32, 25, 32, 73), 'routines.helpers.remaining_space', 'helpers.remaining_space', ({(32, 49, 32, 72): 'config.camera_directory'}, {}), '(config.camera_directory)', True, 'import routines.helpers as helpers\n'), ((38, 14, 38, 54), 'routines.helpers.none_to_null', 'helpers.none_to_null', ({(38, 35, 38, 53): 'camera_drive_space'}, {}), '(camera_drive_space)', True, 'import routines.helpers as helpers\n'), ((16, 24, 17, 43), 'subprocess.check_output', 'subprocess.check_output', ({(17, 26, 17, 42): "['uptime', '-s']"}, {}), "(['uptime', '-s'])", False, 'import subprocess\n'), ((37, 14, 37, 52), 'routines.helpers.none_to_null', 'helpers.none_to_null', ({(37, 35, 37, 51): 'data_drive_space'}, {}), '(data_drive_space)', True, 'import routines.helpers as helpers\n'), ((36, 14, 36, 48), 'routines.helpers.none_to_null', 'helpers.none_to_null', ({(36, 35, 36, 47): 'startup_time'}, {}), '(startup_time)', True, 'import routines.helpers as helpers\n')]