[enhancement] Treat underscores as title part separators

This commit is contained in:
mikiher 2023-10-05 17:53:54 +00:00
parent f3555a12ce
commit bf9f3895db

View File

@ -372,8 +372,8 @@ class BookFinder {
// Now run up to maxFuzzySearches fuzzy searches // Now run up to maxFuzzySearches fuzzy searches
let authorCandidates = new BookFinder.AuthorCandidates(this, cleanAuthor) let authorCandidates = new BookFinder.AuthorCandidates(this, cleanAuthor)
// remove parentheses and their contents, and replace with a separator // remove underscores and parentheses with their contents, and replace with a separator
const cleanTitle = title.replace(/\[.*?\]|\(.*?\)|{.*?}/g, " - ") const cleanTitle = title.replace(/\[.*?\]|\(.*?\)|{.*?}|_/g, " - ")
// Split title into hypen-separated parts // Split title into hypen-separated parts
const titleParts = cleanTitle.split(/ - | -|- /) const titleParts = cleanTitle.split(/ - | -|- /)
for (const titlePart of titleParts) for (const titlePart of titleParts)