concatDemuxer implemented
This commit is contained in:
@@ -122,9 +122,11 @@ module.exports = (_options = {}) => {
|
||||
)
|
||||
);
|
||||
|
||||
const concatDemux = (texFilePath, outputPath, opts = '', del = false, jobId) => {
|
||||
run(`${opts} -f concat -safe 0 -i /data/${texFilePath} -c copy ${outputPath}`,
|
||||
{ del },
|
||||
const concatDemuxer = async (inputPaths, outputPath, opts = '', del = true, jobId) => {
|
||||
const text = inputPaths.reduce((acc, input) => `${acc}\nfile ${input}`, '');
|
||||
await writeText('concat_list.txt', text);
|
||||
return run(`${opts} -f concat -safe 0 -i /data/concat_list.txt -c copy ${outputPath}`,
|
||||
{ del, outputPath, inputPaths: [...inputPaths, 'concat_list.txt'] },
|
||||
jobId);
|
||||
};
|
||||
|
||||
@@ -181,7 +183,7 @@ module.exports = (_options = {}) => {
|
||||
run,
|
||||
transcode,
|
||||
trim,
|
||||
concatDemux,
|
||||
concatDemuxer,
|
||||
ls,
|
||||
terminate,
|
||||
};
|
||||
|
||||
@@ -66,7 +66,9 @@ const ls = ({
|
||||
const run = async ({
|
||||
payload: {
|
||||
args: _args,
|
||||
options: { inputPath, outputPath, del },
|
||||
options: {
|
||||
inputPath, inputPaths, outputPath, del,
|
||||
},
|
||||
},
|
||||
}, res) => {
|
||||
const args = [...defaultArgs, ..._args.trim().split(' ')];
|
||||
@@ -75,6 +77,9 @@ const run = async ({
|
||||
Module.FS.unlink(outputPath);
|
||||
if (del && typeof inputPath === 'string') {
|
||||
await adapter.fs.deleteFile(inputPath);
|
||||
} else if (del && Array.isArray(inputPaths)) {
|
||||
inputPaths.reduce((promise, input) => promise.then(() => adapter.fs.deleteFile(input)),
|
||||
Promise.resolve());
|
||||
}
|
||||
res.resolve({ message: `Complete ${args.join(' ')}` });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user