forked from forks/ffprobe-wasm-npm
fix?: undefined tags
Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
Submodule ffprobe-wasm-app updated: 54b90ac7f5...62ae9d08f0
@@ -92,7 +92,7 @@ export function createListener(
|
||||
function serializeStreams(streams: Vector<Raw<Stream>>) {
|
||||
return vectorToArray(streams).map((stream) => ({
|
||||
...stream,
|
||||
tags: dictionaryVectorToRecord(stream.tags),
|
||||
tags: (stream && stream.tags) ? dictionaryVectorToRecord(stream.tags) : {},
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -109,16 +109,19 @@ export function createListener(
|
||||
|
||||
const rawInfo = get_file_info(`/work/${fileName}`);
|
||||
|
||||
// Safety check on rawInfo itself
|
||||
if (!rawInfo) throw new Error("FFprobe failed to return file info");
|
||||
|
||||
return {
|
||||
streams: serializeStreams(rawInfo.streams),
|
||||
chapters: vectorToArray(rawInfo.chapters).map((chapter) => ({
|
||||
chapters: rawInfo.chapters ? vectorToArray(rawInfo.chapters).map((chapter) => ({
|
||||
...chapter,
|
||||
tags: dictionaryVectorToRecord(chapter.tags),
|
||||
})),
|
||||
tags: chapter.tags ? dictionaryVectorToRecord(chapter.tags) : {},
|
||||
})) : [],
|
||||
format: {
|
||||
...rawInfo.format,
|
||||
tags: dictionaryVectorToRecord(rawInfo.format.tags),
|
||||
},
|
||||
tags: (rawInfo.format && rawInfo.format.tags) ? dictionaryVectorToRecord(rawInfo.format.tags) : {},
|
||||
}
|
||||
};
|
||||
} finally {
|
||||
// Cleanup mount.
|
||||
|
||||
Reference in New Issue
Block a user