The swiss army knife of lossless video/audio editing
add a check on project file open
Mikael Finstad56eec1fa3f2a
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.jsonindex fe972402..50efdd88 100644--- a/public/locales/en/translation.json+++ b/public/locales/en/translation.json@@ -531,6 +531,7 @@"The audio track is not supported. You can convert to a supported format from the menu": "The audio track is not supported. You can convert to a supported format from the menu.","The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.": "The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.","The last executed ffmpeg commands will show up here after you run operations. You can copy them to clipboard and modify them to your needs before running on your command line.": "The last executed ffmpeg commands will show up here after you run operations. You can copy them to clipboard and modify them to your needs before running on your command line.",+ "The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}": "The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}","The media you tried to open does not exist": "The media you tried to open does not exist","The size of the merged output file ({{outputFileTotalSize}}) differs from the total size of source files ({{sourceFilesTotalSize}}) by more than {{maxDiffPercent}}%. This could indicate that there was a problem during the merge.": "The size of the merged output file ({{outputFileTotalSize}}) differs from the total size of source files ({{sourceFilesTotalSize}}) by more than {{maxDiffPercent}}%. This could indicate that there was a problem during the merge.","The video inside segments will be discarded, while the video surrounding them will be kept.": "The video inside segments will be discarded, while the video surrounding them will be kept.",diff --git a/src/App.jsx b/src/App.jsxindex 71b883b1..82f4eec0 100644--- a/src/App.jsx+++ b/src/App.jsx@@ -1305,7 +1305,7 @@ const App = memo(() => {const storeProjectInSourceDir = !storeProjectInWorkingDir;- async function tryOpenProject({ chapters, cod }) {+ async function tryFindAndLoadProjectFile({ chapters, cod }) {try {// First try to open from from working dirif (await tryOpenProjectPath(getEdlFilePath(fp, cod), 'llc')) return;@@ -1413,7 +1413,7 @@ const App = memo(() => {if (projectPath) {await loadEdlFile({ path: projectPath, type: 'llc' });} else {- await tryOpenProject({ chapters: fileMeta.chapters, cod });+ await tryFindAndLoadProjectFile({ chapters: fileMeta.chapters, cod });}// throw new Error('test');@@ -1471,12 +1471,20 @@ const App = memo(() => {console.log('Loading LLC project', path);const project = await loadLlcProject(path);const { mediaFileName } = project;+console.log({ mediaFileName });if (!mediaFileName) return;- projectPath = path;const mediaFilePath = pathJoin(dirname(path), mediaFileName);+ // Note: MAS only allows fs.stat (fs-extra.exists) if we don't have access to input dir yet+ if (!(await exists(mediaFilePath))) {+ errorToast(i18n.t('The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}', { mediaFileName }));+ return;+ }++ projectPath = path;+// We might need to get user's access to the project file's directory, in order to read the media filetry {await ensureAccessToSourceDir(mediaFilePath);