Added try catch to opf fetchNarrators

This commit is contained in:
Igor Kaldowski 2022-02-01 16:50:42 +00:00
parent 4e329a3f8e
commit 4212251c78

View File

@ -83,10 +83,12 @@ function fetchVolumeNumber(metadata) {
function fetchNarrators(creators, metadata) {
var roleNrt = fetchCreator(creators, 'nrt')
if(typeof metadata.meta == "undefined" || roleNrt != null) return roleNrt
var narratorsTag = fetchTagString(metadata.meta, "calibre:user_metadata:#narrators")
if(narratorsTag == null) return narratorsTag
var narratorsJSON = JSON.parse(narratorsTag.replace(/"/g,'"'))
return narratorsJSON["#value#"].join(", ")
try {
var narratorsJSON = JSON.parse(fetchTagString(metadata.meta, "calibre:user_metadata:#narrators").replace(/"/g,'"'))
return narratorsJSON["#value#"].join(", ")
} catch {
return null
}
}
module.exports.parseOpfMetadataXML = async (xml) => {