Media info.pl

From EPrints Documentation
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Back to cfg.d

media_info.pl contains triggers and functions for automatically setting media information of uploaded files. First it has the function $c->{guess_doc_type} which attempts to guess the document type. Initially from some hard-coded tests for common file extensions for documents of types: text, slideshow, archive or spreadsheet. Then it will use $c->{mimemap} generated by mime_types.pl. If it finds nothing it will return document type other.

This file also contains four EP_TRIGGER_MEDIA_INFO trigger functions:

  1. Tests that the uploaded file is of a recognizable MIME type and sets the document object's mime_type field.
  2. If an audio/video file use FFMPEG to extract information to set the document object's media_duration, media_width, media_height, media_video_codec/media_audio_codec, and media_aspect_ratio.
  3. Uses the $c->{mimemap} to set the document object's mime_type field if not already set.
  4. Uses the $c->{guess_doc_type} function to set the document object's mime_type field, if not already set.