abmetadata generator fixes

This commit is contained in:
advplyr 2022-04-20 07:41:45 -05:00
parent fdf332937f
commit 9b8f53caf6

View File

@ -105,7 +105,7 @@ const bookMetadataMapper = {
var sequence = null var sequence = null
var name = series var name = series
var matchResults = series.match(/ #((?:\d*\.?\d+)|(?:\.?\d*))$/) // Pull out sequence # var matchResults = series.match(/ #((?:\d*\.?\d+)|(?:\.?\d*))$/) // Pull out sequence #
if (matchResults.length && matchResults.length > 1) { if (matchResults && matchResults.length && matchResults.length > 1) {
sequence = matchResults[1] // Group 1 sequence = matchResults[1] // Group 1
name = series.replace(matchResults[0], '') name = series.replace(matchResults[0], '')
} }
@ -340,14 +340,14 @@ function checkUpdatedBookSeries(abmetadataSeries, series) {
var findSeries = series.find(se => se.name.toLowerCase() == seriesObj.name.toLowerCase()) var findSeries = series.find(se => se.name.toLowerCase() == seriesObj.name.toLowerCase())
if (!findSeries) { if (!findSeries) {
hasUpdates = true hasUpdates = true
newUpdatedSeries.push({ finalSeries.push({
id: getId('new'), // New series gets created in Scanner.js after library scan id: getId('new'), // New series gets created in Scanner.js after library scan
name: seriesObj.name, name: seriesObj.name,
sequence: seriesObj.sequence sequence: seriesObj.sequence
}) })
} else if (findSeries.sequence != seriesObj.sequence) { // Sequence was updated } else if (findSeries.sequence != seriesObj.sequence) { // Sequence was updated
hasUpdates = true hasUpdates = true
newUpdatedSeries.push({ finalSeries.push({
id: findSeries.id, id: findSeries.id,
name: findSeries.name, name: findSeries.name,
sequence: seriesObj.sequence sequence: seriesObj.sequence