1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-25 11:43:17 +01:00

Auto delete segments on merge #147

This commit is contained in:
Mikael Finstad 2019-05-06 17:37:09 +02:00
parent ed3fcadf2f
commit 397b8b6bf8
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@ const sum = require('lodash/sum');
const readline = require('readline'); const readline = require('readline');
const moment = require('moment'); const moment = require('moment');
const stringToStream = require('string-to-stream'); const stringToStream = require('string-to-stream');
const trash = require('trash');
const { formatDuration, getOutPath, transferTimestamps } = require('./util'); const { formatDuration, getOutPath, transferTimestamps } = require('./util');
@ -211,7 +212,8 @@ async function mergeAnyFiles(paths) {
async function autoMergeSegments({ customOutDir, sourceFile, segmentPaths }) { async function autoMergeSegments({ customOutDir, sourceFile, segmentPaths }) {
const ext = path.extname(sourceFile); const ext = path.extname(sourceFile);
const outPath = getOutPath(customOutDir, sourceFile, `cut-merged-${new Date().getTime()}${ext}`); 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 });
} }
/** /**

View File

@ -786,7 +786,7 @@ class App extends React.Component {
<button <button
type="button" type="button"
title={`Auto merge segments to one file after export? ${autoMerge ? 'Auto merge enabled' : 'No merging'}`} title={`Auto merge segments to one file after export (and trash segments)? ${autoMerge ? 'Auto merge enabled' : 'No merging'}`}
onClick={withBlur(this.toggleAutoMerge)} onClick={withBlur(this.toggleAutoMerge)}
> >
{autoMerge ? 'am' : 'nm'} {autoMerge ? 'am' : 'nm'}