def save(self, bank_index, pedalboard_index): data = { "bank": bank_index, "pedalboard": pedalboard_index } Persistence.save(self.path, data)
def delete_bank(self, bank): """ Delete the bank's file :param Bank bank: Bank that will be removed """ path = self._bank_path(bank) Persistence.delete(path)
def save_bank(self, bank): """ Save the bank in your file :param Bank bank: Bank that will be persisted """ path = self._bank_path(bank) Persistence.save(path, bank.json)
def delete_all_banks(self): """ Delete all banks files. Util for manual save, because isn't possible know which banks were removed """ for file in glob(str(self.data_path) + "/*.json"): Persistence.delete(file)
def _configure_lv2_plugins_data(self): if not self._dao.exists_data: try: self.reload_lv2_plugins_data() self.app.log("Lv2Plugins data - Loaded lv2 plugins data installed") except: self.app.log("Lv2Plugins data - It's not possible reload lv2 plugins data") self.app.log(" Please install lilv") self.app.log("Lv2Plugins data - Using PluginsManager default lv2 plugins data") print(self._dao.data_path, Lv2EffectBuilder.plugins_json_file) self._dao.save(Persistence.read(Path(Lv2EffectBuilder.plugins_json_file))) return Lv2EffectBuilder(plugins_json=self._dao.path)
def load(self, indexables): """ Load the index file and reorder the banks based in order listed in index :param list[Indexable] indexables: Banks that will be reordered based in index file :return list[Bank]: Banks reordered """ try: data = Persistence.read(self.path, create_file=True) except ValueError: data = {} return self.load_data(data, indexables)
def load(self, system_effect): """ Return a list if banks presents in data_path :param SystemEffect system_effect: SystemEffect used in pedalboards :return list[Bank]: List with Banks persisted in :attr:`~pluginsmanager.observer.autosaver.banks_files.BanksFiles.data_path` """ persistence = PersistenceDecoder(system_effect) banks = [] for file in glob(str(self.data_path) + "/*.json"): bank = persistence.read(Persistence.read(file)) bank._uuid = file.split('/')[-1].split('.json')[0] banks.append(bank) return banks
def _configure_lv2_plugins_data(self): if not self._dao.exists_data: try: self.reload_lv2_plugins_data() self.app.log( "Lv2Plugins data - Loaded lv2 plugins data installed") except: self.app.log( "Lv2Plugins data - It's not possible reload lv2 plugins data" ) self.app.log(" Please install lilv") self.app.log( "Lv2Plugins data - Using PluginsManager default lv2 plugins data" ) print(self._dao.data_path, Lv2EffectBuilder.plugins_json_file) self._dao.save( Persistence.read(Path(Lv2EffectBuilder.plugins_json_file))) return Lv2EffectBuilder(plugins_json=self._dao.path)
def save(self, data): Persistence.save(self.path, data)
def load(self): return Persistence.read(self.path)
def save(self, indexables): data = self.generate_data(indexables) Persistence.save(self.path, data)
def save_empty(self): Persistence.save(self.path, {})
def load(self): data = Persistence.read(self.path) return CurrentData(data)