mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-01 00:18:14 +01:00
Merge branch 'master' of https://github.com/advplyr/audiobookshelf
This commit is contained in:
commit
f2e16017f6
@ -194,7 +194,7 @@ class BookMetadata {
|
|||||||
setData(scanMediaData = {}) {
|
setData(scanMediaData = {}) {
|
||||||
this.title = scanMediaData.title || null
|
this.title = scanMediaData.title || null
|
||||||
this.subtitle = scanMediaData.subtitle || null
|
this.subtitle = scanMediaData.subtitle || null
|
||||||
this.narrators = []
|
this.narrators = this.parseNarratorsTag(scanMediaData.narrators)
|
||||||
this.publishedYear = scanMediaData.publishedYear || null
|
this.publishedYear = scanMediaData.publishedYear || null
|
||||||
this.description = scanMediaData.description || null
|
this.description = scanMediaData.description || null
|
||||||
this.isbn = scanMediaData.isbn || null
|
this.isbn = scanMediaData.isbn || null
|
||||||
|
@ -212,7 +212,8 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) {
|
|||||||
var splitDir = relPath.split('/')
|
var splitDir = relPath.split('/')
|
||||||
|
|
||||||
// Audio files will always be in the directory named for the title
|
// Audio files will always be in the directory named for the title
|
||||||
var title = splitDir.pop()
|
var [title, narrators] = getTitleAndNarrator(splitDir.pop())
|
||||||
|
|
||||||
var series = null
|
var series = null
|
||||||
var author = null
|
var author = null
|
||||||
// If there are at least 2 more directories, next furthest will be the series
|
// If there are at least 2 more directories, next furthest will be the series
|
||||||
@ -292,12 +293,19 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) {
|
|||||||
series,
|
series,
|
||||||
sequence: volumeNumber,
|
sequence: volumeNumber,
|
||||||
publishedYear,
|
publishedYear,
|
||||||
|
narrators,
|
||||||
},
|
},
|
||||||
relPath: relPath, // relative audiobook path i.e. /Author Name/Book Name/..
|
relPath: relPath, // relative audiobook path i.e. /Author Name/Book Name/..
|
||||||
path: Path.posix.join(folderPath, relPath) // i.e. /audiobook/Author Name/Book Name/..
|
path: Path.posix.join(folderPath, relPath) // i.e. /audiobook/Author Name/Book Name/..
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTitleAndNarrator(folder) {
|
||||||
|
let pattern = /^(?<title>.*)\{(?<narrators>.*)\} *$/
|
||||||
|
let match = folder.match(pattern)
|
||||||
|
return match ? [match.groups.title.trimEnd(), match.groups.narrators] : [folder, null]
|
||||||
|
}
|
||||||
|
|
||||||
function getPodcastDataFromDir(folderPath, relPath) {
|
function getPodcastDataFromDir(folderPath, relPath) {
|
||||||
relPath = relPath.replace(/\\/g, '/')
|
relPath = relPath.replace(/\\/g, '/')
|
||||||
var splitDir = relPath.split('/')
|
var splitDir = relPath.split('/')
|
||||||
|
Loading…
Reference in New Issue
Block a user