From 13d21e90f82131960c1160f13414e07c894090ca Mon Sep 17 00:00:00 2001 From: Cassie Esposito Date: Thu, 19 May 2022 22:31:55 -0700 Subject: [PATCH] Cleaned function getSubtitle --- server/utils/scandir.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/server/utils/scandir.js b/server/utils/scandir.js index 55072954..2adbb600 100644 --- a/server/utils/scandir.js +++ b/server/utils/scandir.js @@ -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) {