From 23904d57adffd1b4994ad54967053a722c4e4b0a Mon Sep 17 00:00:00 2001 From: Cassie Esposito Date: Thu, 19 May 2022 20:43:17 -0700 Subject: [PATCH] Narrator data is sucessfully saved from folder name. --- server/objects/metadata/BookMetadata.js | 4 ++-- server/utils/scandir.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/objects/metadata/BookMetadata.js b/server/objects/metadata/BookMetadata.js index 59204777..99be71f6 100644 --- a/server/objects/metadata/BookMetadata.js +++ b/server/objects/metadata/BookMetadata.js @@ -194,7 +194,7 @@ class BookMetadata { setData(scanMediaData = {}) { this.title = scanMediaData.title || null this.subtitle = scanMediaData.subtitle || null - this.narrators = [] + this.narrators = this.parseNarratorsTag(scanMediaData.narrators) this.publishedYear = scanMediaData.publishedYear || null this.description = scanMediaData.description || null this.isbn = scanMediaData.isbn || null @@ -356,4 +356,4 @@ class BookMetadata { return null } } -module.exports = BookMetadata \ No newline at end of file +module.exports = BookMetadata diff --git a/server/utils/scandir.js b/server/utils/scandir.js index 7e11f0eb..726183c9 100644 --- a/server/utils/scandir.js +++ b/server/utils/scandir.js @@ -215,6 +215,9 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) { // Audio files will always be in the directory named for the title var [title, narrators] = getTitleAndNarrator(splitDir.pop()) + const parseNameString = require('./parseNameString') + console.log(`\n\n\n${JSON.stringify(parseNameString.parse(narrators), 0, 2)}\n\n\n`) + var series = null var author = null // If there are at least 2 more directories, next furthest will be the series @@ -294,6 +297,7 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) { series, sequence: volumeNumber, publishedYear, + narrators, }, relPath: relPath, // relative audiobook path i.e. /Author Name/Book Name/.. path: Path.posix.join(folderPath, relPath) // i.e. /audiobook/Author Name/Book Name/..