|
@@ -31,6 +31,20 @@ class AlfredParser:
|
|
alfred_dump = '/www/alfred.json'
|
|
alfred_dump = '/www/alfred.json'
|
|
whitelist = [ "24:a4:3c:f8:5e:fa", "24:a4:3c:f8:5e:db", "24:a4:3c:d9:4f:69", "24:a4:3c:a3:67:f0", "24:a4:3c:a3:68:07", "24:a4:3c:d2:21:d5" ]
|
|
whitelist = [ "24:a4:3c:f8:5e:fa", "24:a4:3c:f8:5e:db", "24:a4:3c:d9:4f:69", "24:a4:3c:a3:67:f0", "24:a4:3c:a3:68:07", "24:a4:3c:d2:21:d5" ]
|
|
|
|
|
|
|
|
+ def sanitycheck(self):
|
|
|
|
+ testdata = None
|
|
|
|
+ try:
|
|
|
|
+ testdata = subprocess.check_output(['alfred-json', '-z', 'r', str(int(self.alfred_datatypes[0]))])
|
|
|
|
+ except Exception as err:
|
|
|
|
+ raise Exception("alfred-json not found or incompatible: " + str(err))
|
|
|
|
+
|
|
|
|
+ try:
|
|
|
|
+ check = json.loads(testdata)
|
|
|
|
+ except Exception as err:
|
|
|
|
+ raise Exception("alfred-json does not return valid JSON data: " + str(err))
|
|
|
|
+
|
|
|
|
+ return True
|
|
|
|
+
|
|
def execute(self):
|
|
def execute(self):
|
|
data = { }
|
|
data = { }
|
|
ts = int(time.time())
|
|
ts = int(time.time())
|
|
@@ -81,4 +95,5 @@ class AlfredParser:
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
a = AlfredParser()
|
|
a = AlfredParser()
|
|
|
|
+ a.sanitycheck()
|
|
a.execute()
|
|
a.execute()
|