def dump_device(self, device): filepath = self.get_device_filename(device) if(self.get_device_config(device) or os.path.isfile(filepath)): log('INFO not dumping device: ' + self.get_device_name(device)) return False log('INFO dumping device: ' + self.get_device_name(device)) config = ConfigObj() config.filename = filepath config[self.SECTION_BANKS] = {} config[self.SECTION_BEST_OF] = {} config[self.SECTION_CONFIG] = {} config[self.SECTION_CONFIG]['Cache'] = False config[self.SECTION_CONFIG]['Ignore'] = True ''' Code to dump original ableton mapping - not working bank_names = parameter_bank_names(device, skip = True) banks = parameter_banks(device, skip = True) count = 0 for bank_name in bank_names: config[SECTION_BANKS][bank_name] = {} for param in banks[count]: if(param): config[SECTION_BANKS][bank_name][param.original_name] = param.original_name count = count + 1 #config[SECTION_BEST_OF]['Bank'] = best_of_parameter_bank(device, _ubermap_skip = True) config[SECTION_BEST_OF]['Bank'] = config[SECTION_BANKS].itervalues().next() ''' count = 0 bank = 1 total_count = 1 for i in device.parameters[1:]: if(count == 0): section = 'Bank ' + str(bank) config[self.SECTION_BANKS][section] = {} bank = bank + 1 config[self.SECTION_BANKS][section][str(total_count) + "_" + i.original_name] = i.original_name count = count + 1 total_count = total_count + 1 if(count == self.PARAMS_PER_BANK): count = 0 config[self.SECTION_BEST_OF]['Bank'] = config[self.SECTION_BANKS].itervalues().next() config.write() log('INFO dumped device: ' + self.get_device_name(device))
def __init__(self): self.cfg = config.load('devices') log('INFO UbermapDevices ready')