mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 01:36:08 -07:00
Update classic plugin wrapper with scan types
This commit is contained in:
parent
0921ed23bf
commit
0e3ffd5471
6 changed files with 211 additions and 44 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue