def getImage(): global camera global time_between_picture global nightMode imageFile = None if camera == None: camera = camara.initCamera() camara.resolucionHD() utils.myLog('Waiting {}s for camera warn'.format(TIME2INITCAMERA)) time.sleep(TIME2INITCAMERA) if camera != None: if nightMode: utils.myLog('nigth Mode') camara.addDateNight() imageFile = camara.getImageNight() else: if datetime.datetime.now().hour >= 20 or datetime.datetime.now( ).hour < 7: camara.addDateNight() else: camara.addDate() imageFile = camara.getImage() if time_between_picture == 0 or time_between_picture > 10000: camera = camara.closeCamera() return imageFile
def testImageNight(): for i in range(1, 3): camara.addDateNight() camara.getImageNight() sleep(5)