def testQuerySchema_noDescriptor(self): provider = MetadataSourceAggregator(sources, map) schema = provider.QuerySchema([]) self.assertEquals( "<?xml version='1.0' encoding='UTF-8'?>\n" + "<DescriptionScheme>\n" + " <Attributes/>\n" + "</DescriptionScheme>\n" + "", self.dumpXml(schema))
def testQuerySchema_singleSource(self): provider = MetadataSourceAggregator(sources, map) schema = provider.QuerySchema(["Song::Artist"]) self.assertEquals( "<?xml version='1.0' encoding='UTF-8'?>\n" + "<DescriptionScheme>\n" + " <Attributes>\n" + " <Attribute scope='Song' name='Artist' type='String'/>\n" + " </Attributes>\n" + "</DescriptionScheme>\n" + "", self.dumpXml(schema))
def testQuerySchema_otherSource(self): provider = MetadataSourceAggregator(sources, map) schema = provider.QuerySchema([ "Song::DynamicComplexity", ]) self.assertEquals( "<?xml version='1.0' encoding='UTF-8'?>\n" + "<DescriptionScheme>\n" + " <Attributes>\n" + " <Attribute scope='Song' name='DynamicComplexity' type='Float'>\n" + " <fRange>\n" + " <Min>0</Min>\n" + " <Max>10</Max>\n" + " </fRange>\n" + " </Attribute>\n" + " </Attributes>\n" + "</DescriptionScheme>\n" + "", self.dumpXml(schema))
if not os.access(options.ConfigurationFile, os.R_OK): print >> sys.stderr, "Bad Configuration File!" sys.exit(-1) execfile(options.ConfigurationFile) provider = MetadataSourceAggregator(config.sources, config.map, verbose=config.verbose) if options.printSchema is not None: target = sys.stdout if options.printSchema == "-" else open( options.printSchema, 'w') provider.QuerySchema(provider.AvailableDescriptors()).Dump(target) sys.exit() if not args: parser.print_help() sys.exit() #if options.writeback: sys.exit() for audiofile in args: print "Processing %s..." % audiofile target = open(audiofile + options.suffix, 'w') poolToCopy = provider.QueryDescriptors(audiofile, provider.AvailableDescriptors()) poolToCopy.Dump(target) if options.writeback: