mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 17:54:54 +02:00
Add Subtitle and Narrarator fields, add server settings object, scanner to parse out subtitles
This commit is contained in:
parent
af0365c81f
commit
a66a84bd2d
20 changed files with 213 additions and 31 deletions
|
@ -30,7 +30,9 @@ function getFileType(ext) {
|
|||
return 'unknown'
|
||||
}
|
||||
|
||||
async function getAllAudiobookFiles(abRootPath) {
|
||||
async function getAllAudiobookFiles(abRootPath, serverSettings = {}) {
|
||||
var parseSubtitle = !!serverSettings.scannerParseSubtitle
|
||||
|
||||
var paths = await getPaths(abRootPath)
|
||||
var audiobooks = {}
|
||||
|
||||
|
@ -53,6 +55,7 @@ async function getAllAudiobookFiles(abRootPath) {
|
|||
var title = splitDir.shift()
|
||||
|
||||
var publishYear = null
|
||||
var subtitle = null
|
||||
|
||||
// If Title is of format 1999 - Title, then use 1999 as publish year
|
||||
var publishYearMatch = title.match(/^([0-9]{4}) - (.+)/)
|
||||
|
@ -63,10 +66,17 @@ async function getAllAudiobookFiles(abRootPath) {
|
|||
}
|
||||
}
|
||||
|
||||
if (parseSubtitle && title.includes(' - ')) {
|
||||
var splitOnSubtitle = title.split(' - ')
|
||||
title = splitOnSubtitle.shift()
|
||||
subtitle = splitOnSubtitle.join(' - ')
|
||||
}
|
||||
|
||||
if (!audiobooks[path]) {
|
||||
audiobooks[path] = {
|
||||
author: author,
|
||||
title: title,
|
||||
author,
|
||||
title,
|
||||
subtitle,
|
||||
series: cleanString(series),
|
||||
publishYear: publishYear,
|
||||
path: path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue