pull/2499/head
Mikael Finstad 1 year ago
parent b5c2734b16
commit 250622f955
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -1781,15 +1781,13 @@ function App() {
lastOpenedPathRef.current = filePaths[0]!;
let firstFilePath = filePaths[0]!;
// first check if it is a single directory, and if so, read it recursively
if (filePaths.length === 1) {
const firstFilePath = filePaths[0]!;
const firstFileStat = await lstat(firstFilePath);
if (firstFileStat.isDirectory()) {
console.log('Reading directory...');
invariant(firstFilePath != null);
filePaths = await readDirRecursively(firstFilePath);
}
if (filePaths.length === 1 && (await lstat(firstFilePath)).isDirectory()) {
console.log('Reading directory...');
invariant(firstFilePath != null);
filePaths = await readDirRecursively(firstFilePath);
}
// Only allow opening regular files
@ -1816,7 +1814,7 @@ function App() {
}
// filePaths.length is now 1
const [firstFilePath] = filePaths;
firstFilePath = filePaths[0]!;
invariant(firstFilePath != null);
// https://en.wikibooks.org/wiki/Inside_DVD-Video/Directory_Structure

@ -198,19 +198,19 @@ export function findNearestKeyFrameTime({ frames, time, direction, fps }: { fram
export function tryMapChaptersToEdl(chapters: FFprobeChapter[]) {
try {
return chapters.map((chapter) => {
return chapters.flatMap((chapter) => {
const start = parseFloat(chapter.start_time);
const end = parseFloat(chapter.end_time);
if (Number.isNaN(start) || Number.isNaN(end)) return undefined;
if (Number.isNaN(start) || Number.isNaN(end)) return [];
const name = chapter.tags && typeof chapter.tags.title === 'string' ? chapter.tags.title : undefined;
return {
return [{
start,
end,
name,
};
}).flatMap((it) => (it ? [it] : []));
}];
});
} catch (err) {
console.error('Failed to read chapters from file', err);
return [];

Loading…
Cancel
Save