1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/src/common/SupportedFormats.ts
2023-09-11 18:57:51 +02:00

54 lines
1.9 KiB
TypeScript

import {ClientClass} from './config/public/Config';
let Config: ClientClass;
if (typeof window !== 'undefined') {
// eslint-disable-next-line @typescript-eslint/no-var-requires
Config = require('./config/public/Config').Config;
} else {
// eslint-disable-next-line @typescript-eslint/no-var-requires
Config = require('./config/private/Config').Config;
}
export const SupportedFormats = {
Photos: Config.Media.Photo.supportedFormats,
// Browser supported video formats
// Read more: https://www.w3schools.com/html/html5_video.asp
Videos: Config.Media.Video.supportedFormats,
MetaFiles: Config.MetaFile.supportedFormats,
// These formats need to be transcoded (with the build-in ffmpeg support)
TranscodeNeed: {
// based on libvips, all supported formats for sharp: https://github.com/libvips/libvips
Photos: [] as string[],
Videos: Config.Media.Video.supportedFormatsWithTranscoding,
},
// --------------------------------------------
// Below this, it is autogenerated, DO NOT EDIT
WithDots: {
Photos: [] as string[],
Videos: [] as string[],
MetaFiles: [] as string[],
TranscodeNeed: {
Photos: [] as string[],
Videos: [] as string[],
},
},
};
SupportedFormats.Photos = SupportedFormats.Photos.concat(
SupportedFormats.TranscodeNeed.Photos
);
SupportedFormats.Videos = SupportedFormats.Videos.concat(
SupportedFormats.TranscodeNeed.Videos
);
SupportedFormats.WithDots.Photos = SupportedFormats.Photos.map((f) => '.' + f);
SupportedFormats.WithDots.Videos = SupportedFormats.Videos.map((f) => '.' + f);
SupportedFormats.WithDots.MetaFiles = SupportedFormats.MetaFiles.map(
(f) => '.' + f
);
SupportedFormats.WithDots.TranscodeNeed.Photos =
SupportedFormats.TranscodeNeed.Photos.map((f) => '.' + f);
SupportedFormats.WithDots.TranscodeNeed.Videos =
SupportedFormats.TranscodeNeed.Videos.map((f) => '.' + f);