Skip to content

Commit

Permalink
MDL-56072 filelib: Add new groups and extensions.
Browse files Browse the repository at this point in the history
This patch adds the following groups:

* html_audio: For source files of <audio> tags
* html_video: For source files of <video> tags
* html_track: For source files of <track> tags

It also adds the .vtt extension for track sources, and the flac
extension.
  • Loading branch information
cameorn1730 committed Sep 23, 2016
1 parent 1f27448 commit 676e5dc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
4 changes: 3 additions & 1 deletion lang/en/mimetypes.php
Expand Up @@ -35,6 +35,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['application/epub_zip'] = 'EPUB ebook';
$string['application/msword'] = 'Word document';
$string['application/pdf'] = 'PDF document';
$string['application/vnd.moodle.backup'] = 'Moodle backup';
Expand All @@ -45,7 +46,6 @@
$string['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] = 'Excel spreadsheet';
$string['application/vnd.openxmlformats-officedocument.spreadsheetml.template'] = 'Excel template';
$string['application/vnd.openxmlformats-officedocument.wordprocessingml.document'] = 'Word document';
$string['application/epub_zip'] = 'EPUB ebook';
$string['archive'] = 'Archive ({$a->EXT})';
$string['audio'] = 'Audio file ({$a->EXT})';
$string['default'] = '{$a->mimetype}';
Expand All @@ -54,3 +54,5 @@
$string['text/html'] = 'HTML document';
$string['text/plain'] = 'Text file';
$string['text/rtf'] = 'RTF document';
$string['text/vtt'] = 'Web Video Text Track';
$string['video'] = 'Video file ({$a->EXT})';
42 changes: 29 additions & 13 deletions lib/classes/filetypes.php
Expand Up @@ -50,7 +50,8 @@ protected static function get_default_types() {
'3gp' => array('type' => 'video/quicktime', 'icon' => 'quicktime', 'groups' => array('video'), 'string' => 'video'),
'7z' => array('type' => 'application/x-7z-compressed', 'icon' => 'archive',
'groups' => array('archive'), 'string' => 'archive'),
'aac' => array('type' => 'audio/aac', 'icon' => 'audio', 'groups' => array('audio'), 'string' => 'audio'),
'aac' => array('type' => 'audio/aac', 'icon' => 'audio', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'accdb' => array('type' => 'application/msaccess', 'icon' => 'base'),
'ai' => array('type' => 'application/postscript', 'icon' => 'eps', 'groups' => array('image'), 'string' => 'image'),
'aif' => array('type' => 'audio/x-aiff', 'icon' => 'audio', 'groups' => array('audio'), 'string' => 'audio'),
Expand Down Expand Up @@ -90,6 +91,8 @@ protected static function get_default_types() {
'eps' => array('type' => 'application/postscript', 'icon' => 'eps'),
'epub' => array('type' => 'application/epub+zip', 'icon' => 'epub', 'groups' => array('document')),
'fdf' => array('type' => 'application/pdf', 'icon' => 'pdf'),
'flac' => array('type' => 'audio/flac', 'icon' => 'audio', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'flv' => array('type' => 'video/x-flv', 'icon' => 'flash',
'groups' => array('video', 'web_video'), 'string' => 'video'),
'f4v' => array('type' => 'video/mp4', 'icon' => 'flash', 'groups' => array('video', 'web_video'), 'string' => 'video'),
Expand Down Expand Up @@ -142,13 +145,20 @@ protected static function get_default_types() {
'mw' => array('type' => 'application/maple', 'icon' => 'math'),
'mws' => array('type' => 'application/maple', 'icon' => 'math'),
'm3u' => array('type' => 'audio/x-mpegurl', 'icon' => 'mp3', 'groups' => array('audio'), 'string' => 'audio'),
'mp3' => array('type' => 'audio/mp3', 'icon' => 'mp3', 'groups' => array('audio', 'web_audio'), 'string' => 'audio'),
'mp4' => array('type' => 'video/mp4', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'),
'm4v' => array('type' => 'video/mp4', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'),
'm4a' => array('type' => 'audio/mp4', 'icon' => 'mp3', 'groups' => array('audio'), 'string' => 'audio'),
'mpeg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'),
'mpe' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'),
'mpg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'),
'mp3' => array('type' => 'audio/mp3', 'icon' => 'mp3', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'mp4' => array('type' => 'video/mp4', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),
'm4v' => array('type' => 'video/mp4', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),
'm4a' => array('type' => 'audio/mp4', 'icon' => 'mp3', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'mpeg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),
'mpe' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),
'mpg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),
'mpr' => array('type' => 'application/vnd.moodle.profiling', 'icon' => 'moodle'),

'nbk' => array('type' => 'application/x-smarttech-notebook', 'icon' => 'archive'),
Expand All @@ -171,9 +181,12 @@ protected static function get_default_types() {
'odf' => array('type' => 'application/vnd.oasis.opendocument.formula', 'icon' => 'math'),
'odb' => array('type' => 'application/vnd.oasis.opendocument.database', 'icon' => 'base'),
'odi' => array('type' => 'application/vnd.oasis.opendocument.image', 'icon' => 'draw'),
'oga' => array('type' => 'audio/ogg', 'icon' => 'audio', 'groups' => array('audio'), 'string' => 'audio'),
'ogg' => array('type' => 'audio/ogg', 'icon' => 'audio', 'groups' => array('audio'), 'string' => 'audio'),
'ogv' => array('type' => 'video/ogg', 'icon' => 'video', 'groups' => array('video'), 'string' => 'video'),
'oga' => array('type' => 'audio/ogg', 'icon' => 'audio', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'ogg' => array('type' => 'audio/ogg', 'icon' => 'audio', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'ogv' => array('type' => 'video/ogg', 'icon' => 'video', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),

'pct' => array('type' => 'image/pict', 'icon' => 'image', 'groups' => array('image'), 'string' => 'image'),
'pdf' => array('type' => 'application/pdf', 'icon' => 'pdf'),
Expand Down Expand Up @@ -246,8 +259,11 @@ protected static function get_default_types() {
'texinfo' => array('type' => 'application/x-texinfo', 'icon' => 'text'),
'tsv' => array('type' => 'text/tab-separated-values', 'icon' => 'text'),
'txt' => array('type' => 'text/plain', 'icon' => 'text', 'defaulticon' => true),
'wav' => array('type' => 'audio/wav', 'icon' => 'wav', 'groups' => array('audio'), 'string' => 'audio'),
'webm' => array('type' => 'video/webm', 'icon' => 'video', 'groups' => array('video'), 'string' => 'video'),
'vtt' => array('type' => 'text/vtt', 'icon' => 'text', 'groups' => array('html_track')),
'wav' => array('type' => 'audio/wav', 'icon' => 'wav', 'groups' => array('audio'. 'html_audio', 'web_audio'),
'string' => 'audio'),
'webm' => array('type' => 'video/webm', 'icon' => 'video', 'groups' => array('html_video', 'video', 'web_video'),
'string' => 'video'),
'wmv' => array('type' => 'video/x-ms-wmv', 'icon' => 'wmv', 'groups' => array('video'), 'string' => 'video'),
'asf' => array('type' => 'video/x-ms-asf', 'icon' => 'wmv', 'groups' => array('video'), 'string' => 'video'),
'wma' => array('type' => 'audio/x-ms-wma', 'icon' => 'audio', 'groups' => array('audio'), 'string' => 'audio'),
Expand Down

0 comments on commit 676e5dc

Please sign in to comment.