def cfg_details(about): if about == 'tvservice': result = {} result['resolution'] = display.available() result['status'] = display.current() return jsonify(result) elif about == 'current': image, mime = display.get() response = app.make_response(image) response.headers.set('Content-Type', mime) return response elif about == 'drivers': result = drivers.list().keys() return jsonify(result) elif about == 'timezone': result = helper.timezoneList() return jsonify(result) elif about == 'version': output = subprocess.check_output(['git', 'log', '-n1'], stderr=void) lines = output.split('\n') infoDate = lines[2][5:].strip() infoCommit = lines[0][7:].strip() output = subprocess.check_output(['git', 'status'], stderr=void) lines = output.split('\n') infoBranch = lines[0][10:].strip() return jsonify({'date':infoDate, 'commit':infoCommit, 'branch': infoBranch}) elif about == 'color': return jsonify(slideshow.getColorInformation()) elif about == 'sensor': return jsonify({'sensor' : colormatch.hasSensor()}) elif about == 'display': return jsonify({'display':display.isEnabled()}) abort(404)
return jsonify({'control': True}) settings = settings() drivers = drivers() m = re.search('([0-9]+)x([0-9]+)', cmdline.size) if m is None: logging.error('--size has to be WIDTHxHEIGHT') sys.exit(1) display = display(cmdline.emulate, int(m.group(1)), int(m.group(2))) if not settings.load(): # First run, grab display settings from current mode current = display.current() if current is not None: logging.info('No display settings, using: %s' % repr(current)) settings.setUser('tvservice', '%s %s HDMI' % (current['mode'], current['code'])) settings.save() else: logging.info('No display attached?') if settings.getUser('timezone') == '': settings.setUser('timezone', helper.timezoneCurrent()) settings.save() width, height, tvservice = display.setConfiguration( settings.getUser('tvservice'), settings.getUser('display-special')) settings.setUser('tvservice', tvservice) settings.setUser('width', width)