diff --git a/server/utils/scandir.js b/server/utils/scandir.js index 6dd2d67fe..59a0c2427 100644 --- a/server/utils/scandir.js +++ b/server/utils/scandir.js @@ -150,8 +150,8 @@ function getBookDataFromDir(relPath, parseSubtitle = false) { const splitDir = relPath.split('/') var folder = splitDir.pop() // Audio files will always be in the directory named for the title - series = splitDir.length > 1 ? splitDir.pop() : null // If there are at least 2 more directories, next furthest will be the series - author = splitDir.length > 0 ? splitDir.pop() : null // There could be many more directories, but only the top 3 are used for naming /author/series/title/ + var series = splitDir.length > 1 ? splitDir.pop() : null // If there are at least 2 more directories, next furthest will be the series + var author = splitDir.length > 0 ? splitDir.pop() : null // There could be many more directories, but only the top 3 are used for naming /author/series/title/ // The may contain various other pieces of metadata, these functions extract it. var [folder, asin] = getASIN(folder) @@ -234,7 +234,7 @@ function getSequence(folder) { function getPublishedYear(folder) { var publishedYear = null - pattern = /^ *\(?([0-9]{4})\)? * - *(.+)/ //Matches #### - title or (####) - title + const pattern = /^ *\(?([0-9]{4})\)? * - *(.+)/ //Matches #### - title or (####) - title var match = folder.match(pattern) if (match) { publishedYear = match[1]