[Clam-devel] Refactoring CLAM Networks files
David García Garzón
dgarcia at iua.upf.edu
Thu Oct 30 09:30:19 PDT 2008
Right now one of the harder parts of changing things in CLAM, such class
names, port and control names, and config parameters was having to update the
network files. I just programed a litle python module that is intended to be
an smart migration tool for clam networks. It is located at
CLAM/scripts/clamrefactor.py
Right now you can load a network by doing:
network = ClamNetwork('mynetwork.clamnetwork')
Then you can apply any of the smart operators available:
network.renameClass('OldProcessing','NewProcessing')
network.renameConnector('AudioMixer', "inport", "Input 0", "lala")
network.renameConfig('AudioMixer', "NumberOfInPorts", "NInputs")
network.setConfigByType('AudioMixer', "NInputs", "14")
network.setConfig('Gain 0', "Max", "2")
network.addConfig('AudioMixer', 'Ramping', '1')
network.addConfig('AudioMixer', 'NInputs', '96')
network.removeConfig('AudioMixer', 'FrameSize')
Any help to enhance the script is welcome. Is very easy to add new
functionality as it is based on simple XPath. Just check the existing
commands. Some TODO's:
TODO: More operators: reorderConfig, renameProcessingInstance...
TODO: Making it easy to use on command line, not just as library
TODO: Reading 'migration scripts' with a set of those commands
TODO: Add CLAM version information into the networks and check it.
TODO: Being able to update also ui files
David.
More information about the clam-devel
mailing list