def zone_mute(zone_id): if request.values['mute'] == '1': power = True else: power = False logging.debug(str(zone_id) + " setting mute to " + str(power)) command = Lync12.set_mute(zone_id, power) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def zone_power_all(): if request.values['power'] == '1': power = True else: power = False logging.debug("setting power to of all zones to " + str(power)) command = Lync12.set_power(0, power) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def status(): global __dirty_bit global __json_cache global __cache_timeout global __status_update_time current_time = datetime.datetime.now() run_time = __status_update_time + datetime.timedelta(seconds=__cache_timeout) if __dirty_bit or run_time < current_time: logging.debug('refreshing status') command = Lync12.get_zone_state() __json_cache = execute_command(command) __status_update_time = datetime.datetime.now() __dirty_bit = False return jsonify(__json_cache)
def mp3_controls(action): action_id = Lync12.MP3_NULL if not action: abort(404) elif action == 'play': action_id = Lync12.MP3_PLAY elif action == 'stop': action_id = Lync12.MP3_STOP elif action == 'repeatoff': action_id = Lync12.MP3_REPEAT_OFF elif action == 'repeaton': action_id = Lync12.MP3_REPEAT_ON elif action == 'forward': action_id = Lync12.MP3_FF elif action == 'back' or action == 'reverse': action_id = Lync12.MP3_FB else: logging.error('MP3 URL error: ' + action) command = Lync12.mp3_action(action_id) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def model(): command = Lync12.get_model() return jsonify(execute_command(command))
def zone_base(zone_id): bass_val = request.values['bass'] command = Lync12.set_bass(zone_id, bass_val) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def zone_treble(zone_id): treble_val = request.values['treble'] command = Lync12.set_treble(zone_id, treble_val) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def zone_input(zone_id): input_src = request.values['input'] command = Lync12.set_input(zone_id, input_src) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def zone_volume(zone_id): command = Lync12.set_volume(zone_id, volume) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))
def zone_volume(zone_id): volume = int(request.values['volume']) command = Lync12.set_volume(zone_id, volume) global __dirty_bit __dirty_bit = True return jsonify(execute_command(command))