Update classic plugin wrapper with scan types

This commit is contained in:
HaveAGitGat 2023-09-06 08:32:27 +01:00
parent 0921ed23bf
commit 0e3ffd5471
6 changed files with 211 additions and 44 deletions

View file

@ -104,3 +104,50 @@ export const getPluginWorkDir = (args: IpluginInputArgs):string => {
args.deps.fsextra.ensureDirSync(pluginWorkDir);
return pluginWorkDir;
};
export interface IscanTypes {
mediaInfoScan: boolean,
exifToolScan: boolean,
closedCaptionScan: boolean,
[index: string]: boolean,
}
export const getScanTypes = (pluginsTextRaw: string[]): IscanTypes => {
const scanTypes: IscanTypes = {
exifToolScan: true,
mediaInfoScan: false,
closedCaptionScan: false,
};
const scannerTypes = [
// needed for frame and duration data for ffmpeg
// {
// type: 'exifToolScan',
// terms: [
// 'meta',
// ],
// },
{
type: 'mediaInfoScan',
terms: [
'mediaInfo',
],
},
{
type: 'closedCaptionScan',
terms: [
'hasClosedCaptions',
],
},
];
const text = pluginsTextRaw.join('');
scannerTypes.forEach((scanner) => {
scanner.terms.forEach((term) => {
if (text.includes(term)) {
scanTypes[scanner.type] = true;
}
});
});
return scanTypes;
};