Update the MP3 extractor to output audio keys (related to ALF-6170), and refactor the audio extractors to share more common code. Also expands the audio extractor tests to share common code, and test more metadata. (Needed for devcon demo)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31013 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-10-06 16:17:06 +00:00
parent e180abafe4
commit 9f60d2b246
11 changed files with 438 additions and 88 deletions

View File

@@ -88,18 +88,21 @@ public abstract class TikaPoweredMetadataExtracter extends AbstractMappingMetada
* Builds up a list of supported mime types by merging an explicit
* list with any that Tika also claims to support
*/
protected static ArrayList<String> buildSupportedMimetypes(String[] explicitTypes, Parser tikaParser) {
protected static ArrayList<String> buildSupportedMimetypes(String[] explicitTypes, Parser... tikaParsers) {
ArrayList<String> types = new ArrayList<String>();
for(String type : explicitTypes) {
if(!types.contains(type)) {
types.add(type);
}
}
if(tikaParser != null) {
for(MediaType mt : tikaParser.getSupportedTypes(new ParseContext())) {
String type = mt.toString();
if(!types.contains(type)) {
types.add(type);
if(tikaParsers != null) {
for(Parser tikaParser : tikaParsers)
{
for(MediaType mt : tikaParser.getSupportedTypes(new ParseContext())) {
String type = mt.toString();
if(!types.contains(type)) {
types.add(type);
}
}
}
}
@@ -225,9 +228,11 @@ public abstract class TikaPoweredMetadataExtracter extends AbstractMappingMetada
{
is = getInputStream(reader);
Parser parser = getParser();
Metadata metadata = new Metadata();
ParseContext context = new ParseContext();
Metadata metadata = new Metadata();
metadata.add(Metadata.CONTENT_TYPE, reader.getMimetype());
ContentHandler handler;
Map<String,String> headers = null;
if(needHeaderContents()) {