Better code organization

parent f4087849
......@@ -941,7 +941,7 @@ def getVoiceCommandList():
def getScreenshotUri(target):
qstring="select screenshot from mediasources where button_name LIKE '"+target+"%' limit 1"
qstring="select screenshot from mediasources where button_name LIKE '"+target+"%'"
return runQuery(qstring)
def getClimaUniques():
......
......@@ -2455,13 +2455,16 @@ class domotikaService(service.Service):
def web_on_getScreenshotList(self, screenshot=True):
return dmdb.getScreenshotList(screenshot=screenshot)
def web_on_getScreenshot(self, target):
def web_on_getScreenshot(self, target, callback=None):
def imageReturn(img):
return img
def prepareScreenshot(res):
if callback == None:
if res:
return wu.getPage(res[0][0]).addCallback(imageReturn)
return False
for r in res:
wu.getPage(r[0]).addCallback(callback)
return dmdb.getScreenshotUri(target).addCallback(prepareScreenshot)
def web_on_getClimaUniques(self):
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment