Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caption and subtitle file formats to default allowedFileExtensions and fileKinds #7304

Closed
missmatsuko opened this issue Dec 20, 2020 · 3 comments · Fixed by #7336
Closed
Labels
accessibility 👤 features related to accessibility enhancement improvements to existing features
Milestone

Comments

@missmatsuko
Copy link
Contributor

missmatsuko commented Dec 20, 2020

Description

Add a new file kind for captions and subtitles so config changes aren't needed to upload captions and subtitles for videos.

The WebVTT format (.vtt) is likely the most useful format since it can be used on the web with the HTML5 video element, but there's others web caption and subtitle formats listed here:

Suggested values:

[
    'asc',
    'cap',
    'cin',
    'dfxp',
    'itt',
    'lrc',
    'mcc',
    'mpsub',
    'rt',
    'sami',
    'sbv',
    'scc',
    'smi',
    'srt',
    'stl',
    'sub',
    'tds',
    'ttml',
    'txt',
    'vtt',
    'xml',
]

Some of the caption and subtitle file formats are included in other file kinds (e.g. .txt, .xml). I think having the same file extension in multiple file kinds might break the code that identifies file kind.

@missmatsuko missmatsuko added enhancement improvements to existing features accessibility 👤 features related to accessibility labels Dec 20, 2020
@brandonkelly brandonkelly added this to the 3.6 milestone Dec 26, 2020
@brandonkelly brandonkelly linked a pull request Dec 26, 2020 that will close this issue
2 tasks
@brandonkelly
Copy link
Member

@missmatsuko Do you think we should be adding two separate file kinds – “Captions” and “Subtitles” – or just one? And what should the file kind label(s) be?

Current file kinds are defined here:

cms/src/helpers/Assets.php

Lines 378 to 591 in c4b999b

self::$_fileKinds = [
Asset::KIND_ACCESS => [
'label' => Craft::t('app', 'Access'),
'extensions' => [
'adp',
'accdb',
'mdb',
'accde',
'accdt',
'accdr',
]
],
Asset::KIND_AUDIO => [
'label' => Craft::t('app', 'Audio'),
'extensions' => [
'3gp',
'aac',
'act',
'aif',
'aiff',
'aifc',
'alac',
'amr',
'au',
'dct',
'dss',
'dvf',
'flac',
'gsm',
'iklax',
'ivs',
'm4a',
'm4p',
'mmf',
'mp3',
'mpc',
'msv',
'oga',
'ogg',
'opus',
'ra',
'tta',
'vox',
'wav',
'wma',
'wv',
]
],
Asset::KIND_COMPRESSED => [
'label' => Craft::t('app', 'Compressed'),
'extensions' => [
'bz2',
'tar',
'gz',
'7z',
's7z',
'dmg',
'rar',
'zip',
'tgz',
'zipx',
]
],
Asset::KIND_EXCEL => [
'label' => Craft::t('app', 'Excel'),
'extensions' => [
'xls',
'xlsx',
'xlsm',
'xltx',
'xltm',
]
],
Asset::KIND_FLASH => [
'label' => Craft::t('app', 'Flash'),
'extensions' => [
'fla',
'flv',
'swf',
'swt',
'swc',
]
],
Asset::KIND_HTML => [
'label' => Craft::t('app', 'HTML'),
'extensions' => [
'html',
'htm',
]
],
Asset::KIND_ILLUSTRATOR => [
'label' => Craft::t('app', 'Illustrator'),
'extensions' => [
'ai',
]
],
Asset::KIND_IMAGE => [
'label' => Craft::t('app', 'Image'),
'extensions' => [
'jfif',
'jp2',
'jpx',
'jpg',
'jpeg',
'jpe',
'tiff',
'tif',
'png',
'gif',
'bmp',
'webp',
'ppm',
'pgm',
'pnm',
'pfm',
'pam',
'svg',
]
],
Asset::KIND_JAVASCRIPT => [
'label' => Craft::t('app', 'JavaScript'),
'extensions' => [
'js',
]
],
Asset::KIND_JSON => [
'label' => Craft::t('app', 'JSON'),
'extensions' => [
'json',
]
],
Asset::KIND_PDF => [
'label' => Craft::t('app', 'PDF'),
'extensions' => ['pdf']
],
Asset::KIND_PHOTOSHOP => [
'label' => Craft::t('app', 'Photoshop'),
'extensions' => [
'psd',
'psb',
]
],
Asset::KIND_PHP => [
'label' => Craft::t('app', 'PHP'),
'extensions' => ['php']
],
Asset::KIND_POWERPOINT => [
'label' => Craft::t('app', 'PowerPoint'),
'extensions' => [
'pps',
'ppsm',
'ppsx',
'ppt',
'pptm',
'pptx',
'potx',
]
],
Asset::KIND_TEXT => [
'label' => Craft::t('app', 'Text'),
'extensions' => [
'txt',
'text',
]
],
Asset::KIND_VIDEO => [
'label' => Craft::t('app', 'Video'),
'extensions' => [
'avchd',
'asf',
'asx',
'avi',
'flv',
'fla',
'mov',
'm4v',
'mng',
'mpeg',
'mpg',
'm1s',
'm2t',
'mp2v',
'm2v',
'm2s',
'mp4',
'mkv',
'qt',
'flv',
'mp4',
'ogg',
'ogv',
'rm',
'wmv',
'webm',
'vob',
]
],
Asset::KIND_WORD => [
'label' => Craft::t('app', 'Word'),
'extensions' => [
'doc',
'docx',
'dot',
'docm',
'dotm',
]
],
Asset::KIND_XML => [
'label' => Craft::t('app', 'XML'),
'extensions' => [
'xml',
]
],
];

Some of the caption and subtitle file formats are included in other file kinds (e.g. .txt, .xml). I think having the same file extension in multiple file kinds might break the code that identifies file kind.

We can add the same extension to multiple file kinds, but assets’ kind property will only be set to the first match.

@missmatsuko
Copy link
Contributor Author

missmatsuko commented Dec 26, 2020

@brandonkelly

Do you think we should be adding two separate file kinds – “Captions” and “Subtitles” – or just one? And what should the file kind label(s) be?

It should be one file kind for both captions and subtitles. To go along with the casing of the other file kinds, maybe the label could be "Caption/Subtitle" or "Caption or Subtitle" or "Caption and Subtitle"?

We can add the same extension to multiple file kinds, but assets’ kind property will only be set to the first match.

Okay, then I guess the text file kind should come before the caption and subtitle file kind so text becomes the first match?

@brandonkelly
Copy link
Member

Alright, done. Called it “Captions/Subtitles” (plural because a single file contains multiple captions/subtitles, so singular felt awkward).

Decided to leave .txt and .xml out of it – there are already dedicated file kinds for each of those, so if someone wants to allow an Assets field to allow them, they can just tick all three checkboxes.

A list of file kinds within an Assets field’s settings, with “Captions/Subtitles”, “Text”, and “XML” checkboxes ticked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility 👤 features related to accessibility enhancement improvements to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants