mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-04 04:59:37 +01:00
Cleaned function getSubtitle
This commit is contained in:
parent
dd664da871
commit
13d21e90f8
@ -220,7 +220,7 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) {
|
|||||||
var [title, narrators] = getNarrator(title)
|
var [title, narrators] = getNarrator(title)
|
||||||
if (series) { var [series, title, sequence] = getSeries(series, title) }
|
if (series) { var [series, title, sequence] = getSeries(series, title) }
|
||||||
var [title, publishedYear] = getPublishedYear(title)
|
var [title, publishedYear] = getPublishedYear(title)
|
||||||
if (parseSubtitle) { var [title, subtitle] = getSubtitle(title) }
|
if (parseSubtitle) { var [title, subtitle] = getSubtitle(title) } // Subtitle can be parsed from the title if user enabled
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mediaMetadata: {
|
mediaMetadata: {
|
||||||
@ -286,15 +286,9 @@ function getSeries(series, title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getSubtitle(title) {
|
function getSubtitle(title) {
|
||||||
// Subtitle can be parsed from the title if user enabled
|
|
||||||
// Subtitle is everything after " - "
|
// Subtitle is everything after " - "
|
||||||
var subtitle = null
|
var splitTitle = title.split(' - ')
|
||||||
if (title.includes(' - ')) {
|
return [splitTitle.shift(), splitTitle.join(' - ')]
|
||||||
var splitOnSubtitle = title.split(' - ')
|
|
||||||
title = splitOnSubtitle.shift()
|
|
||||||
subtitle = splitOnSubtitle.join(' - ')
|
|
||||||
}
|
|
||||||
return [title, subtitle]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPublishedYear(title) {
|
function getPublishedYear(title) {
|
||||||
|
Loading…
Reference in New Issue
Block a user