Skip to content

Commit 9bc4a1b

Browse files
authored
Support converting audio element without file (#784)
In SAB, you can configure an audio entry that has a timing file but without an audio file. It is not useful, but it is allowed. Change the conversion of the appdef.xml to config.json to ignore audio entries without file sub-entries.
1 parent cab32a1 commit 9bc4a1b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

convert/convertConfig.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,10 @@ function parseBookCollections(document: Document, verbose: number) {
523523
const audioTag = page.getElementsByTagName('audio')[0];
524524
if (!audioTag) continue;
525525
const fTag = audioTag.getElementsByTagName('f')[0];
526-
if (verbose >= 2)
527-
console.log(`... audioTag: ${audioTag.outerHTML}, fTag:${fTag.outerHTML}`);
526+
if (verbose >= 2) {
527+
console.log(`... audioTag: ${audioTag.outerHTML}, fTag:${fTag?.outerHTML}`);
528+
}
529+
if (!fTag) continue;
528530
audio.push({
529531
num: parseInt(page.attributes.getNamedItem('num')!.value),
530532
filename: fTag.innerHTML,

0 commit comments

Comments
 (0)