Esempio n. 1
0
def system_info():
    viewlog = None
    try:
        viewlog = [
            line.decode('utf-8') for line in check_output([
                'sudo', 'systemctl', 'status', 'screenly-viewer.service', '-n',
                '20'
            ]).split('\n')
        ]
    except:
        pass

    loadavg = diagnostics.get_load_avg()['15 min']

    display_info = diagnostics.get_monitor_status()

    display_power = diagnostics.get_display_power()

    # Calculate disk space
    slash = statvfs("/")
    free_space = size(slash.f_bavail * slash.f_frsize)

    # Get uptime
    uptime_in_seconds = diagnostics.get_uptime()
    system_uptime = timedelta(seconds=uptime_in_seconds)

    # Player name for title
    player_name = settings['player_name']

    raspberry_model = '%s Revision: %s Ram: %s %s' % (
        diagnostics.get_raspberry_model(),
        diagnostics.get_raspberry_revision(), diagnostics.get_raspberry_ram(),
        diagnostics.get_raspberry_manufacturer())

    branch = 'development' if diagnostics.get_git_branch(
    ) == 'master' else diagnostics.get_git_branch()
    screenly_version = '%s@%s' % (branch, diagnostics.get_git_short_hash())

    return template('system-info.html',
                    player_name=player_name,
                    viewlog=viewlog,
                    loadavg=loadavg,
                    free_space=free_space,
                    uptime=system_uptime,
                    display_info=display_info,
                    display_power=display_power,
                    raspberry_model=raspberry_model,
                    screenly_version=screenly_version,
                    mac_address=get_node_mac_address())
Esempio n. 2
0
def system_info():
    viewlog = None
    try:
        viewlog = [line.decode('utf-8') for line in
                   check_output(['sudo', 'systemctl', 'status', 'screenly-viewer.service', '-n', '20']).split('\n')]
    except:
        pass

    loadavg = diagnostics.get_load_avg()['15 min']

    display_info = diagnostics.get_monitor_status()

    display_power = diagnostics.get_display_power()

    # Calculate disk space
    slash = statvfs("/")
    free_space = size(slash.f_bavail * slash.f_frsize)

    # Get uptime
    uptime_in_seconds = diagnostics.get_uptime()
    system_uptime = timedelta(seconds=uptime_in_seconds)

    # Player name for title
    player_name = settings['player_name']

    raspberry_model = '%s Revision: %s Ram: %s %s' % (diagnostics.get_raspberry_model(),
                                                      diagnostics.get_raspberry_revision(),
                                                      diagnostics.get_raspberry_ram(),
                                                      diagnostics.get_raspberry_manufacturer())

    branch = 'development' if diagnostics.get_git_branch() == 'master' else diagnostics.get_git_branch()
    screenly_version = '%s@%s' % (branch, diagnostics.get_git_short_hash())

    return template(
        'system_info.html',
        player_name=player_name,
        viewlog=viewlog,
        loadavg=loadavg,
        free_space=free_space,
        uptime=system_uptime,
        display_info=display_info,
        display_power=display_power,
        raspberry_model=raspberry_model,
        screenly_version=screenly_version,
        mac_address=get_node_mac_address()
    )