mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Merge pull request #343 from igorkaldowski/master
Fetch Narrators from opf custom column
This commit is contained in:
commit
316ae4ff79
@ -80,6 +80,17 @@ function fetchVolumeNumber(metadata) {
|
||||
return fetchTagString(metadata.meta, "calibre:series_index")
|
||||
}
|
||||
|
||||
function fetchNarrators(creators, metadata) {
|
||||
var roleNrt = fetchCreator(creators, 'nrt')
|
||||
if(typeof metadata.meta == "undefined" || roleNrt != null) return roleNrt
|
||||
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) => {
|
||||
var json = await xmlToJSON(xml)
|
||||
if (!json || !json.package || !json.package.metadata) return null
|
||||
@ -101,7 +112,7 @@ module.exports.parseOpfMetadataXML = async (xml) => {
|
||||
var data = {
|
||||
title: fetchTitle(metadata),
|
||||
author: fetchCreator(creators, 'aut'),
|
||||
narrator: fetchCreator(creators, 'nrt'),
|
||||
narrator: fetchNarrators(creators, metadata),
|
||||
publishYear: fetchDate(metadata),
|
||||
publisher: fetchPublisher(metadata),
|
||||
isbn: fetchISBN(metadata),
|
||||
|
Loading…
Reference in New Issue
Block a user