Jump to content

Media info.pl

From EPrints Documentation
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


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.