From 02a2862ca94433df172725ca4076c278c2b2cef9 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Sun, 9 Feb 2014 15:13:51 +0100 Subject: [PATCH] alfred.py: Transfer more data from alfred into the alias list --- alfred.py | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/alfred.py b/alfred.py index 086ebc7..067d435 100755 --- a/alfred.py +++ b/alfred.py @@ -13,12 +13,36 @@ class alfred: for mac,node in alfred_data.items(): node_alias = {} if 'location' in node: - node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude']) + if 'latitude' in node['location'] and 'longitude' in node['location']: + node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude']) - try: - node_alias['firmware'] = node['software']['firmware']['release'] - except KeyError: - pass + if 'software' in node: + + if 'firmware' in node['software']: + if 'base' in node['software']['firmware']: + node_alias['firmware-base'] = node['software']['firmware']['base'] + if 'release' in node['software']['firmware']: + node_alias['firmware'] = node['software']['firmware']['release'] + + if 'autoupdater' in node['software']: + if 'branch' in node['software']['autoupdater']: + node_alias['autoupdater-branch'] = node['software']['autoupdater']['branch'] + if 'enabled' in node['software']['autoupdater']: + node_alias['autoupdater-enabled'] = node['software']['autoupdater']['enabled'] + + if 'fastd' in node['software']: + if 'enabled' in node['software']['fastd']: + node_alias['fastd-enabled'] = node['software']['fastd']['enabled'] + if 'version' in node['software']['fastd']: + node_alias['fastd-version'] = node['software']['fastd']['version'] + + if 'hardware' in node: + if 'model' in node['hardware']: + node_alias['hardware-model'] = node['hardware']['model'] + + if 'network' in node: + if 'gateway' in node['network']: + node_alias['selected-gateway'] = node['network']['gateway'] if 'hostname' in node: node_alias['name'] = node['hostname']