The swiss army knife of lossless video/audio editing
add logging when saving #2496
Mikael Finstad250829ba4577
diff --git a/src/renderer/src/edlStore.ts b/src/renderer/src/edlStore.tsindex 4a07c484..66428774 100644--- a/src/renderer/src/edlStore.ts+++ b/src/renderer/src/edlStore.ts@@ -81,14 +81,14 @@ export async function saveSrt(path: string, cutSegments: SegmentBase[]) {await writeFile(path, formatSrt(cutSegments));}-export async function saveLlcProject({ savePath, filePath, cutSegments }: {+export async function saveLlcProject({ savePath, mediaFilePath, cutSegments }: {savePath: string,- filePath: string,+ mediaFilePath: string,cutSegments: StateSegment[],}) {const projectData: LlcProject = {version: 2,- mediaFileName: basename(filePath),+ mediaFileName: basename(mediaFilePath),cutSegments: mapSaveableSegments(cutSegments),};await writeFile(savePath, JSON5.stringify(projectData, null, 2));@@ -222,6 +222,6 @@ export async function exportEdlFile({ type, cutSegments, customOutDir, filePath,else if (type === 'tsv-human') await saveTsv(savePath, cutSegments);else if (type === 'csv-human') await saveCsvHuman(savePath, cutSegments);else if (type === 'csv-frames') await saveCsvFrames({ path: savePath, cutSegments, getFrameCount });- else if (type === 'llc') await saveLlcProject({ savePath, filePath, cutSegments });+ else if (type === 'llc') await saveLlcProject({ savePath, mediaFilePath: filePath, cutSegments });else if (type === 'srt') await saveSrt(savePath, cutSegments);}diff --git a/src/renderer/src/hooks/useSegmentsAutoSave.ts b/src/renderer/src/hooks/useSegmentsAutoSave.tsindex 00254e53..1f0dd7a1 100644--- a/src/renderer/src/hooks/useSegmentsAutoSave.ts+++ b/src/renderer/src/hooks/useSegmentsAutoSave.ts@@ -29,6 +29,7 @@ export default ({ autoSaveProjectFile, storeProjectInWorkingDir, filePath, custoreturn { cutSegments, projectFileSavePath, filePath };}, [cutSegments, filePath, projectFileSavePath]);+ // NOTE: Could lose a save if user closes too fast, but not a big issue I thinkconst [debouncedSaveOperation] = useDebounce(currentSaveOperation, isDev ? 2000 : 500);const lastSaveOperation = useRef<typeof debouncedSaveOperation>();@@ -36,7 +37,6 @@ export default ({ autoSaveProjectFile, storeProjectInWorkingDir, filePath, custouseEffect(() => {async function save() {try {- // NOTE: Could lose a save if user closes too fast, but not a big issue I thinkif (!autoSaveProjectFile|| !debouncedSaveOperation|| debouncedSaveOperation.filePath == null@@ -49,7 +49,8 @@ export default ({ autoSaveProjectFile, storeProjectInWorkingDir, filePath, custoreturn;}- await saveLlcProject({ savePath: debouncedSaveOperation.projectFileSavePath, filePath: debouncedSaveOperation.filePath, cutSegments: debouncedSaveOperation.cutSegments });+ console.log('Saving project file', debouncedSaveOperation.projectFileSavePath, debouncedSaveOperation.cutSegments);+ await saveLlcProject({ savePath: debouncedSaveOperation.projectFileSavePath, mediaFilePath: debouncedSaveOperation.filePath, cutSegments: debouncedSaveOperation.cutSegments });lastSaveOperation.current = debouncedSaveOperation;} catch (err) {errorToast(i18n.t('Unable to save project file'));