def lampSwitch(): processes = [] oldSession, _ = collectProcesses(processes) if oldSession: kill() else: Popen(['python', 'banner.py'], cwd='/home/pi/server/api/tracks/') return 'on'
def post(self): kill() app.logger.info("onPulse called") try: schema = onBasicSchema() except ValidationError as err: app.logger.error(err) return err.messages result = schema.loads(request.data.decode('UTF-8')) colour = ', '.join(map(str, result['colour'])) app.logger.info(colour) app.logger.info(result['intensity']) Popen([ 'python', 'pulse.py', '-i', str(result['intensity']), '-c', colour ], cwd='/home/pi/server/api/tracks/') return 'on'
def post(self): kill() app.logger.info("onSolid called") try: schema = onBannerSchema() except ValidationError as err: app.logger.error(err) return err.messages result = schema.loads(request.data.decode('UTF-8')) colourOne = ', '.join(map(str, result['colours']['firstColour'])) colourTwo = ', '.join(map(str, result['colours']['secondColour'])) app.logger.info(result['colours']) app.logger.info(result['intensity']) Popen([ 'python', 'banner.py', '-i', str(result['intensity']), '-bc', colourOne, '-wc', colourTwo ], cwd='/home/pi/server/api/tracks/') return 'on'
def get(self): app.logger.info("Off called") kill() cleanUp() return "off"