mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-01 19:49:26 +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)
|
||||
if (series) { var [series, title, sequence] = getSeries(series, 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 {
|
||||
mediaMetadata: {
|
||||
@ -286,15 +286,9 @@ function getSeries(series, title) {
|
||||
}
|
||||
|
||||
function getSubtitle(title) {
|
||||
// Subtitle can be parsed from the title if user enabled
|
||||
// Subtitle is everything after " - "
|
||||
var subtitle = null
|
||||
if (title.includes(' - ')) {
|
||||
var splitOnSubtitle = title.split(' - ')
|
||||
title = splitOnSubtitle.shift()
|
||||
subtitle = splitOnSubtitle.join(' - ')
|
||||
}
|
||||
return [title, subtitle]
|
||||
var splitTitle = title.split(' - ')
|
||||
return [splitTitle.shift(), splitTitle.join(' - ')]
|
||||
}
|
||||
|
||||
function getPublishedYear(title) {
|
||||
|
Loading…
Reference in New Issue
Block a user