Extractor de metadatos personalizados de Alfresco

I have developed a custom metadata extractor to extract detailed metadata for audio and video files. The extractor extends AbstractMappingMetadataExtracter and it needs to map extracted fields into a custom type. The extractor class is named AudioMetadataExtractor and a corresponding properties file contains the mappings. Following is the code for the class

public class AudioMetadataExtractor extends AbstractBaseMetadataExtractor {

public static ArrayList<String> SUPPORTED_MIMETYPES = addMimeTypes(new String[] { MimeTypes.MIMETYPE_MP3, MimeTypes.MIMETYPE_WMA });

public AudioMetadataExtractor() {

public AudioMetadataExtractor(ArrayList<String> supportedMimeTypes) {

protected Map<String, Serializable> extractRaw(ContentReader reader) throws Throwable {

    Map<String, Serializable> rawProperties = newRawMap();

    File file = TempFileProvider.createTempFile("DCM", "MINFO");

    MediaInfoJNA mediaInfoLib = new MediaInfoJNA();

    String album = mediaInfoLib.Get(StreamKind.General, 0, "Album", MediaInfoJNA.InfoKind.Text, MediaInfoJNA.InfoKind.Name);
    System.out.println("Album1 " + album);
    String title = mediaInfoLib.Get(StreamKind.General, 0, "Title", MediaInfoJNA.InfoKind.Text, MediaInfoJNA.InfoKind.Name);
    System.out.println("Title " + title);
    String duration = mediaInfoLib.Get(StreamKind.General, 0, "Duration", MediaInfoJNA.InfoKind.Text, MediaInfoJNA.InfoKind.Name);
    System.out.println("Duration " + duration);

    putRawValue("album", album, rawProperties);


    return rawProperties;

The configuration for the extractor is as follows

<bean id="metadata.extractor.AudioAsset" class="com.diipl.moviebeam.dcm.alfresco.metadata.AudioMetadataExtractor" parent="baseMetadataExtracter">
    <property name="inheritDefaultMapping">

Problem: When uploading a new file the extractor is being called and I can see all the sysouts with correct values. However, the properties are not filled with any values. But if I run the "Extract Common Metadata" action on the file the extractor gets called and the fields get the correct values.

preguntado el 31 de julio de 12 a las 12:07

On the space where you are uploading to, do you have rule set up to extract common metadata? -

No I don't have a rule setup on the space. Is the rule required? Alfresco seems to be invoking my custom extractor at the time of uploading the file but after that it does not seem to be writing the properties extracted. -

I think so. But I'm not totally sure... -

Are you uploading a new version of an existing file, or a brand new file? (It can make a big difference) -

Pretty sure that rule is required. I've noticed that even the built-in EXIF extraction for images won't fire without that rule if you are putting files into the repository using any method other than Share upload/drag-and-drop. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.