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

improve feedback

This commit is contained in:
Mikael Finstad 2020-02-15 15:57:40 +08:00
parent 4109c7c1cd
commit d91ca6373a
2 changed files with 9 additions and 4 deletions

View File

@ -30,7 +30,7 @@ const ffmpeg = require('./ffmpeg');
const {
getOutPath, parseDuration, formatDuration, toast, errorToast, showFfmpegFail, setFileNameTitle,
promptTimeOffset, generateColor,
promptTimeOffset, generateColor, getOutDir,
} = require('./util');
const { dialog } = electron.remote;
@ -417,6 +417,7 @@ const App = memo(() => {
showFfmpegFail(err);
} finally {
toast.fire({ timer: 10000, type: 'success', title: `Cut completed! Output file(s) can be found at: ${getOutDir(customOutDir, filePath)}. You can change the output directory in settings` });
setWorking(false);
}
}, [

View File

@ -36,12 +36,15 @@ function parseDuration(str) {
return ((((hours * 60) + minutes) * 60) + seconds) + (ms / 1000);
}
function getOutDir(customOutDir, filePath) {
const dirname = path.dirname(filePath);
return customOutDir || dirname;
}
function getOutPath(customOutDir, filePath, nameSuffix) {
const basename = path.basename(filePath);
return customOutDir
? path.join(customOutDir, `${basename}-${nameSuffix}`)
: `${filePath}-${nameSuffix}`;
return path.join(getOutDir(customOutDir, filePath), `${basename}-${nameSuffix}`);
}
async function transferTimestamps(inPath, outPath) {
@ -114,6 +117,7 @@ module.exports = {
formatDuration,
parseDuration,
getOutPath,
getOutDir,
transferTimestamps,
transferTimestampsWithOffset,
toast,