def chart(): global chart_asked # not cool python cgminer = Cgminer() now = time.time() if (now - chart_asked) > 60 * 5: try: line_chart.append(cgminer.latest_hashrate_poins()) chart_asked = now except CgminerError as e: return jsonify({ 'status': 'error', 'message': 'CgminerError: ' + e.message, 'lines': [] }) except Exception as e: return jsonify({ 'status': 'error', 'message': 'Exception: ' + e.message, 'lines': [] }) return jsonify({ 'status': 'success', 'lines': line_chart.lines() })
def summary(): cgminer = Cgminer() try: response = { 'status': 'success', 'summary': cgminer.summary() } except CgminerError as e: response = { 'status': 'error', 'message': 'CgminerError: ' + e.message, 'summary': {} } except Exception as e: response = { 'status': 'error', 'message': 'Exception: ' + e.message, 'devices': [] } return jsonify(response)
def update_pools(): cgminer = Cgminer() cgminer.save(cgminer_config_path) return 'Hello world!'