Alfred input: Pass -z switch to alfred-json
parent
322860be7e
commit
cd1329963a
|
@ -5,23 +5,19 @@ class Input:
|
||||||
def __init__(self,request_data_type = 158):
|
def __init__(self,request_data_type = 158):
|
||||||
self.request_data_type = request_data_type
|
self.request_data_type = request_data_type
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _call_alfred(request_data_type):
|
||||||
|
return json.loads(subprocess.check_output([
|
||||||
|
"alfred-json",
|
||||||
|
"-z",
|
||||||
|
"-r", str(request_data_type),
|
||||||
|
"-f", "json",
|
||||||
|
]).decode("utf-8"))
|
||||||
|
|
||||||
def get_data(self, nodedb):
|
def get_data(self, nodedb):
|
||||||
"""Add data from alfred to the supplied nodedb"""
|
"""Add data from alfred to the supplied nodedb"""
|
||||||
# get nodeinfo
|
nodeinfo = self._call_alfred(self.request_data_type)
|
||||||
output = subprocess.check_output([
|
statistics = self._call_alfred(self.request_data_type+1)
|
||||||
"alfred-json",
|
|
||||||
"-r", str(self.request_data_type),
|
|
||||||
"-f", "json",
|
|
||||||
])
|
|
||||||
nodeinfo = json.loads(output.decode("utf-8"))
|
|
||||||
|
|
||||||
# get statistics
|
|
||||||
output = subprocess.check_output([
|
|
||||||
"alfred-json",
|
|
||||||
"-r", str(self.request_data_type+1),
|
|
||||||
"-f", "json",
|
|
||||||
])
|
|
||||||
statistics = json.loads(output.decode("utf-8"))
|
|
||||||
|
|
||||||
# merge statistics into nodeinfo to be compatible with earlier versions
|
# merge statistics into nodeinfo to be compatible with earlier versions
|
||||||
for mac, node in statistics.items():
|
for mac, node in statistics.items():
|
||||||
|
|
Loading…
Reference in New Issue