alfred.py: better ask for forgiveness, than permission

This commit is contained in:
Martin Weinelt 2015-03-24 17:00:35 +01:00
parent 3291b2b6ba
commit e098cd8d77

View file

@ -24,11 +24,13 @@ def aliases():
alias = {} alias = {}
for node in nodeinfo(): for node in nodeinfo():
node_alias = {} node_alias = {}
if 'location' in node:
try: try:
node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude']) # TODO: better pass lat, lng as a tuple?
except KeyError: node_alias['gps'] = "{lat}\x20{lng}".format(lat=node['location']['latitude'],
pass lng=node['location']['longitude'])
except KeyError:
pass
try: try:
node_alias['firmware'] = node['software']['firmware']['release'] node_alias['firmware'] = node['software']['firmware']['release']