From 397b8b6bf82c123a1275ac61afc5d9a0035a10a6 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 6 May 2019 17:37:09 +0200 Subject: [PATCH] Auto delete segments on merge #147 --- src/ffmpeg.js | 4 +++- src/renderer.jsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 367d401e..cc030ec1 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -9,6 +9,7 @@ const sum = require('lodash/sum'); const readline = require('readline'); const moment = require('moment'); const stringToStream = require('string-to-stream'); +const trash = require('trash'); const { formatDuration, getOutPath, transferTimestamps } = require('./util'); @@ -211,7 +212,8 @@ async function mergeAnyFiles(paths) { async function autoMergeSegments({ customOutDir, sourceFile, segmentPaths }) { const ext = path.extname(sourceFile); const outPath = getOutPath(customOutDir, sourceFile, `cut-merged-${new Date().getTime()}${ext}`); - return mergeFiles(segmentPaths, outPath); + await mergeFiles(segmentPaths, outPath); + await bluebird.map(segmentPaths, trash, { concurrency: 5 }); } /** diff --git a/src/renderer.jsx b/src/renderer.jsx index e6da209f..83184108 100644 --- a/src/renderer.jsx +++ b/src/renderer.jsx @@ -786,7 +786,7 @@ class App extends React.Component {