feat: auto-populate series ASIN from Audible metadata

- Update Audible provider to return series ASIN in search results
- Pass series ASIN through Match.vue when selecting metadata
- Update Book.updateSeriesFromRequest to forward ASIN to Series model
- Update Scanner to use series ASIN during quick match

When using the Audible metadata provider, the series ASIN is now
automatically captured and stored with the series.
This commit is contained in:
Quentin King 2026-01-03 10:34:25 -06:00
parent edbd49c4c1
commit d5a2ea9feb
4 changed files with 38 additions and 7 deletions

View file

@ -524,8 +524,16 @@ class Book extends Model {
hasUpdates = true
Logger.debug(`[Book] "${this.title}" Updated series "${existingSeries.name}" sequence ${seriesObjSequence}`)
}
// Update series ASIN if provided and not already set
if (seriesObj.asin && !existingSeries.audibleSeriesAsin) {
existingSeries.audibleSeriesAsin = seriesObj.asin
await existingSeries.save()
const SocketAuthority = require('../SocketAuthority')
SocketAuthority.emitter('series_updated', existingSeries.toOldJSON())
Logger.debug(`[Book] "${this.title}" Updated series "${existingSeries.name}" ASIN ${seriesObj.asin}`)
}
} else {
const series = await seriesModel.findOrCreateByNameAndLibrary(seriesObj.name, libraryId)
const series = await seriesModel.findOrCreateByNameAndLibrary(seriesObj.name, libraryId, seriesObj.asin)
series.bookSeries = await bookSeriesModel.create({ bookId: this.id, seriesId: series.id, sequence: seriesObjSequence })
this.series.push(series)
seriesAdded.push(series)
@ -553,7 +561,7 @@ class Book extends Model {
*/
oldMetadataToJSON() {
const authors = this.authors.map((au) => ({ id: au.id, name: au.name }))
const series = this.series.map((se) => ({ id: se.id, name: se.name, sequence: se.bookSeries.sequence }))
const series = this.series.map((se) => ({ id: se.id, name: se.name, sequence: se.bookSeries.sequence, audibleSeriesAsin: se.audibleSeriesAsin }))
return {
title: this.title,
subtitle: this.subtitle,