def __init__(self, filename, extdata=None): self.filename = filename self.basename = noext_name(filename) self.extdata = pickle.dumps(extdata) if extdata != None else None
def generate_script(self, input_file): script_file = open(self.script_dir+input_file+".praat",'w') print "[praat][script][generate]> Generating script for '%s' at '%s'" % (input_file,self.script_dir+input_file+".praat") script_template = C3N_PRAAT_SCRIPT for option,values in self.options.iteritems(): script_template = script_template.replace(values[2],('1' if values[0] else '0')) script_template = script_template.replace('<<inputdir>>',self.input_dir).replace('<<inputfile>>',input_file) #try: # os.mkdir(self.output_dir+input_file+'/') #except: # shutil.rmtree(self.output_dir+input_file+'/') # os.mkdir(self.output_dir+input_file+'/') script_template = script_template.replace('<<outputdir>>',self.output_dir).replace('<<inputname>>',noext_name(input_file)) script_file.write(script_template)