mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 09:38:43 +03:00
feat: add .mxf file support (#24644)
* feat: add support for MXF format in media handling * Updated supported formats documentation to include MXF. * Added MXF to valid video extensions in tests. * Registered MXF MIME type in mime-types utility. * fix: enhance MXF handling in mime-types utility * Updated video mime type validation to include 'application/mxf'. * Adjusted asset type determination to recognize MXF as a video container. * chore: clean up --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
@@ -110,6 +110,7 @@ const validVideos = [
|
||||
'.mp4',
|
||||
'.mpg',
|
||||
'.mts',
|
||||
'.mxf',
|
||||
'.vob',
|
||||
'.webm',
|
||||
'.wmv',
|
||||
|
||||
@@ -76,6 +76,7 @@ describe('mimeTypes', () => {
|
||||
{ mimetype: 'image/x-sony-sr2', extension: '.sr2' },
|
||||
{ mimetype: 'image/x-sony-srf', extension: '.srf' },
|
||||
{ mimetype: 'image/x3f', extension: '.x3f' },
|
||||
{ mimetype: 'application/mxf', extension: '.mxf' },
|
||||
{ mimetype: 'video/3gpp', extension: '.3gp' },
|
||||
{ mimetype: 'video/3gpp', extension: '.3gpp' },
|
||||
{ mimetype: 'video/avi', extension: '.avi' },
|
||||
@@ -188,7 +189,9 @@ describe('mimeTypes', () => {
|
||||
|
||||
it('should contain only video mime types', () => {
|
||||
const values = Object.values(mimeTypes.video).flat();
|
||||
expect(values).toEqual(values.filter((mimeType) => mimeType.startsWith('video/')));
|
||||
expect(values).toEqual(
|
||||
values.filter((mimeType) => mimeType.startsWith('video/') || mimeType === 'application/mxf'),
|
||||
);
|
||||
});
|
||||
|
||||
for (const [extension, v] of Object.entries(mimeTypes.video)) {
|
||||
|
||||
@@ -98,6 +98,7 @@ const video: Record<string, string[]> = {
|
||||
'.mpeg': ['video/mpeg'],
|
||||
'.mpg': ['video/mpeg'],
|
||||
'.mts': ['video/mp2t'],
|
||||
'.mxf': ['application/mxf'],
|
||||
'.vob': ['video/mpeg'],
|
||||
'.webm': ['video/webm'],
|
||||
'.wmv': ['video/x-ms-wmv'],
|
||||
@@ -141,9 +142,12 @@ export const mimeTypes = {
|
||||
const contentType = lookup(filename);
|
||||
if (contentType.startsWith('image/')) {
|
||||
return AssetType.Image;
|
||||
} else if (contentType.startsWith('video/')) {
|
||||
}
|
||||
|
||||
if (contentType.startsWith('video/') || contentType === 'application/mxf') {
|
||||
return AssetType.Video;
|
||||
}
|
||||
|
||||
return AssetType.Other;
|
||||
},
|
||||
getSupportedFileExtensions: () => [...Object.keys(image), ...Object.keys(video)],
|
||||
|
||||
Reference in New Issue
Block a user