Skip to content

Commit

Permalink
Support converting audio element without file (#784)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chrisvire authored and aidanpscott committed Jan 27, 2025
1 parent a8724f1 commit 0d2c527
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions convert/convertConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,10 @@ function parseBookCollections(document: Document, verbose: number) {
const audioTag = page.getElementsByTagName('audio')[0];
if (!audioTag) continue;
const fTag = audioTag.getElementsByTagName('f')[0];
if (verbose >= 2)
console.log(`... audioTag: ${audioTag.outerHTML}, fTag:${fTag.outerHTML}`);
if (verbose >= 2) {
console.log(`... audioTag: ${audioTag.outerHTML}, fTag:${fTag?.outerHTML}`);
}
if (!fTag) continue;
audio.push({
num: parseInt(page.attributes.getNamedItem('num')!.value),
filename: fTag.innerHTML,
Expand Down

0 comments on commit 0d2c527

Please sign in to comment.