- if not (args[0] in self.convfilt_config.keys()):
- print 'This is not an internal convfilt variable!'
- print 'Run "setconv" without arguments to see a list of defined variables.'
- return
-
- if len(args)==1:
- print self.convfilt_config[args[0]]
- elif len(args)>1:
- try:
- self.convfilt_config[args[0]]=eval(args[1])
- except NameError: #we have a string argument
- self.convfilt_config[args[0]]=args[1]
-
-
-#########################
-#HANDLING OF CONFIGURATION FILE
-class ConvfiltConfig(object):
- '''
- Handling of convfilt configuration file
-
- Mostly based on the simple-yet-useful examples of the Python Library Reference
- about xml.dom.minidom
-
- FIXME: starting to look a mess, should require refactoring
- '''
-
- def __init__(self):
- self.config={}
-
-
- def load_config(self, filename):
- myconfig=file(filename)
- #the following 3 lines are needed to strip newlines. otherwise, since newlines
- #are XML elements too, the parser would read them (and re-save them, multiplying
- #newlines...)
- #yes, I'm an XML n00b
- the_file=myconfig.read()
- the_file_lines=the_file.split('\n')
- the_file=''.join(the_file_lines)
-
- self.config_tree=xml.dom.minidom.parseString(the_file)
-
- def getText(nodelist):
- #take the text from a nodelist
- #from Python Library Reference 13.7.2
- rc = ''
- for node in nodelist:
- if node.nodeType == node.TEXT_NODE:
- rc += node.data
- return rc
-
- def handleConfig(config):
- noiseabsdev_elements=config.getElementsByTagName("noise_absdev")
- convfilt_elements=config.getElementsByTagName("convfilt")
- handleAbsdev(noiseabsdev_elements)
- handleConvfilt(convfilt_elements)
-
- def handleAbsdev(noiseabsdev_elements):
- for element in noiseabsdev_elements:
- for attribute in element.attributes.keys():
- self.config[attribute]=element.getAttribute(attribute)
-
- def handleConvfilt(convfilt_elements):
- for element in convfilt_elements:
- for attribute in element.attributes.keys():
- self.config[attribute]=element.getAttribute(attribute)
-
- handleConfig(self.config_tree)
- #making items in the dictionary machine-readable
- for item in self.config.keys():
- try:
- self.config[item]=eval(self.config[item])
- except NameError: #if it's an unreadable string, keep it as a string
- pass
+ if len(features) < playlist.count:
+ self.AppendToOutput(''.join(['Found ', str(len(features)), ' potentially interesting files.']))
+ self.AppendToOutput('Regenerating playlist...')
+ playlist_filtered = playlist.filter_curves(features)
+ self.AddPlaylist(playlist_filtered, name='convfilt')
+ else:
+ self.AppendToOutput('No files filtered. Try different filtering criteria.')