Difference between revisions of "Media info.pl"
(Added config file page.) |
m |
||
Line 4: | Line 4: | ||
'''media_info.pl''' contains triggers and functions for automatically setting media information of uploaded files. First it has the function <code>$c->{guess_doc_type}</code> 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 <code>$c->{mimemap}</code> generated by [[mime_types.pl]]. If it finds nothing it will return document type ''other''. | '''media_info.pl''' contains triggers and functions for automatically setting media information of uploaded files. First it has the function <code>$c->{guess_doc_type}</code> 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 <code>$c->{mimemap}</code> generated by [[mime_types.pl]]. If it finds nothing it will return document type ''other''. | ||
− | This file also contains four trigger functions: | + | This file also contains four <code>EP_TRIGGER_MEDIA_INFO</code> trigger functions: |
# Tests that the uploaded file is of a recognizable MIME type and sets the document object's ''mime_type'' field. | # Tests that the uploaded file is of a recognizable MIME type and sets the document object's ''mime_type'' field. | ||
# 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''. | # 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''. | ||
# Uses the <code>$c->{mimemap}</code> to set the document object's ''mime_type'' field if not already set. | # Uses the <code>$c->{mimemap}</code> to set the document object's ''mime_type'' field if not already set. | ||
# Uses the <code>$c->{guess_doc_type}</code> function to set the document object's ''mime_type'' field, if not already set. | # Uses the <code>$c->{guess_doc_type}</code> function to set the document object's ''mime_type'' field, if not already set. |
Latest revision as of 10:28, 7 February 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
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:
- Tests that the uploaded file is of a recognizable MIME type and sets the document object's mime_type field.
- 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.
- Uses the
$c->{mimemap}
to set the document object's mime_type field if not already set. - Uses the
$c->{guess_doc_type}
function to set the document object's mime_type field, if not already set.