-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4c7eae
commit 810e8eb
Showing
2 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
FlowPlugins/CommunityFlowPlugins/audio/checkAudioCodec/1.0.0/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.plugin = exports.details = void 0; | ||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ | ||
var details = function () { return ({ | ||
name: 'Check Audio Codec', | ||
description: 'Check if a file has a specific audio codec', | ||
style: { | ||
borderColor: 'orange', | ||
}, | ||
tags: 'audio', | ||
isStartPlugin: false, | ||
pType: '', | ||
requiresVersion: '2.11.01', | ||
sidebarPosition: -1, | ||
icon: 'faQuestion', | ||
inputs: [ | ||
{ | ||
name: 'codec', | ||
type: 'string', | ||
defaultValue: 'aac', | ||
inputUI: { | ||
type: 'dropdown', | ||
options: [ | ||
'aac', | ||
'ac3', | ||
'eac3', | ||
'dca', | ||
'dts', | ||
'flac', | ||
'mp2', | ||
'mp3', | ||
'opus', | ||
'truehd', | ||
'vorbis', | ||
'wav', | ||
'wma', | ||
], | ||
}, | ||
tooltip: 'Specify the codec check for', | ||
}, | ||
], | ||
outputs: [ | ||
{ | ||
number: 1, | ||
tooltip: 'File has codec', | ||
}, | ||
{ | ||
number: 2, | ||
tooltip: 'File does not have codec', | ||
}, | ||
], | ||
}); }; | ||
exports.details = details; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
var plugin = function (args) { | ||
var lib = require('../../../../../methods/lib')(); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign | ||
args.inputs = lib.loadDefaultValues(args.inputs, details); | ||
var hasCodec = false; | ||
if (args.inputFileObj.ffProbeData.streams) { | ||
args.inputFileObj.ffProbeData.streams.forEach(function (stream) { | ||
if (stream.codec_type === 'audio' && stream.codec_name === args.inputs.codec) { | ||
hasCodec = true; | ||
} | ||
}); | ||
} | ||
return { | ||
outputFileObj: args.inputFileObj, | ||
outputNumber: hasCodec ? 1 : 2, | ||
variables: args.variables, | ||
}; | ||
}; | ||
exports.plugin = plugin; |
83 changes: 83 additions & 0 deletions
83
FlowPluginsTs/CommunityFlowPlugins/audio/checkAudioCodec/1.0.0/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { | ||
IpluginDetails, | ||
IpluginInputArgs, | ||
IpluginOutputArgs, | ||
} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces'; | ||
|
||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ | ||
const details = ():IpluginDetails => ({ | ||
name: 'Check Audio Codec', | ||
description: 'Check if a file has a specific audio codec', | ||
style: { | ||
borderColor: 'orange', | ||
}, | ||
tags: 'audio', | ||
isStartPlugin: false, | ||
pType: '', | ||
requiresVersion: '2.11.01', | ||
sidebarPosition: -1, | ||
icon: 'faQuestion', | ||
inputs: [ | ||
{ | ||
name: 'codec', | ||
type: 'string', | ||
defaultValue: 'aac', | ||
inputUI: { | ||
type: 'dropdown', | ||
options: [ | ||
'aac', | ||
'ac3', | ||
'eac3', | ||
'dca', | ||
'dts', | ||
'flac', | ||
'mp2', | ||
'mp3', | ||
'opus', | ||
'truehd', | ||
'vorbis', | ||
'wav', | ||
'wma', | ||
], | ||
}, | ||
tooltip: 'Specify the codec check for', | ||
}, | ||
], | ||
outputs: [ | ||
{ | ||
number: 1, | ||
tooltip: 'File has codec', | ||
}, | ||
{ | ||
number: 2, | ||
tooltip: 'File does not have codec', | ||
}, | ||
], | ||
}); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const plugin = (args:IpluginInputArgs):IpluginOutputArgs => { | ||
const lib = require('../../../../../methods/lib')(); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign | ||
args.inputs = lib.loadDefaultValues(args.inputs, details); | ||
|
||
let hasCodec = false; | ||
|
||
if (args.inputFileObj.ffProbeData.streams) { | ||
args.inputFileObj.ffProbeData.streams.forEach((stream) => { | ||
if (stream.codec_type === 'audio' && stream.codec_name === args.inputs.codec) { | ||
hasCodec = true; | ||
} | ||
}); | ||
} | ||
|
||
return { | ||
outputFileObj: args.inputFileObj, | ||
outputNumber: hasCodec ? 1 : 2, | ||
variables: args.variables, | ||
}; | ||
}; | ||
export { | ||
details, | ||
plugin, | ||
}; |