From 14e5e11344b49d9296ec8427a42b9799ba0e9a71 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 1 Oct 2022 17:01:22 -0500 Subject: [PATCH] Cleaned series match & renaming volumeNumber to sequence --- client/components/cards/BookMatchCard.vue | 2 +- client/components/cards/LazyBookCard.vue | 3 ++- client/components/modals/item/tabs/Match.vue | 26 ++++++-------------- server/providers/Audible.js | 2 +- server/scanner/Scanner.js | 4 +-- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/client/components/cards/BookMatchCard.vue b/client/components/cards/BookMatchCard.vue index 009072c7..d458664f 100644 --- a/client/components/cards/BookMatchCard.vue +++ b/client/components/cards/BookMatchCard.vue @@ -19,7 +19,7 @@

- {{ series.series }} #{{ series.volumeNumber }} + {{ series.series }} #{{ series.sequence }}

diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index c18c3117..859894a2 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -182,7 +182,8 @@ export default { return this.mediaType === 'podcast' }, placeholderUrl() { - return `${this.$config.routerBasePath}/book_placeholder.jpg` + const config = this.$config || this.$nuxt.$config + return `${config.routerBasePath}/book_placeholder.jpg` }, bookCoverSrc() { return this.store.getters['globals/getLibraryItemCoverSrc'](this._libraryItem, this.placeholderUrl) diff --git a/client/components/modals/item/tabs/Match.vue b/client/components/modals/item/tabs/Match.vue index a4cd0cbb..626112eb 100644 --- a/client/components/modals/item/tabs/Match.vue +++ b/client/components/modals/item/tabs/Match.vue @@ -100,10 +100,6 @@

Currently: {{ mediaMetadata.seriesName || '' }}

-
- - -
@@ -208,7 +204,6 @@ export default { publisher: true, publishedYear: true, series: true, - volumeNumber: true, genres: true, tags: true, language: true, @@ -246,9 +241,9 @@ export default { return this.selectedMatch.series.map((se) => { return { id: `new-${Math.floor(Math.random() * 10000)}`, - displayName: se.volumeNumber ? `${se.series} #${se.volumeNumber}` : se.series, + displayName: se.sequence ? `${se.series} #${se.sequence}` : se.series, name: se.series, - sequence: se.volumeNumber || '' + sequence: se.sequence || '' } }) }, @@ -353,7 +348,6 @@ export default { publisher: true, publishedYear: true, series: true, - volumeNumber: true, genres: true, tags: true, language: true, @@ -396,9 +390,9 @@ export default { match.series = match.series.map((se) => { return { id: `new-${Math.floor(Math.random() * 10000)}`, - displayName: se.volumeNumber ? `${se.series} #${se.volumeNumber}` : se.series, + displayName: se.sequence ? `${se.series} #${se.sequence}` : se.series, name: se.series, - sequence: se.volumeNumber || '' + sequence: se.sequence || '' } }) } @@ -417,18 +411,13 @@ export default { var updatePayload = {} updatePayload.metadata = {} - var volumeNumber = this.selectedMatchUsage.volumeNumber ? this.selectedMatch.volumeNumber || null : null for (const key in this.selectedMatchUsage) { if (this.selectedMatchUsage[key] && this.selectedMatch[key]) { if (key === 'series') { - var seriesPayload = [] if (!Array.isArray(this.selectedMatch[key])) { - seriesPayload.push({ - id: `new-${Math.floor(Math.random() * 10000)}`, - name: this.selectedMatch[key], - sequence: volumeNumber - }) + console.error('Invalid series in selectedMatch', this.selectedMatch[key]) } else { + var seriesPayload = [] this.selectedMatch[key].forEach((seriesItem) => seriesPayload.push({ id: seriesItem.id, @@ -436,9 +425,8 @@ export default { sequence: seriesItem.sequence }) ) + updatePayload.metadata.series = seriesPayload } - - updatePayload.metadata.series = seriesPayload } else if (key === 'author' && !this.isPodcast) { var authors = this.selectedMatch[key] if (!Array.isArray(authors)) { diff --git a/server/providers/Audible.js b/server/providers/Audible.js index 4330f0b7..b669eff0 100644 --- a/server/providers/Audible.js +++ b/server/providers/Audible.js @@ -27,7 +27,7 @@ class Audible { asin, genres: genresFiltered.length ? genresFiltered : null, tags: tagsFiltered.length ? tagsFiltered.join(', ') : null, - series: series != [] ? series.map(({ name, position }) => ({ series: name, volumeNumber: position })) : null, + series: series != [] ? series.map(({ name, position }) => ({ series: name, sequence: position })) : null, language: language ? language.charAt(0).toUpperCase() + language.slice(1) : null, duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0 } diff --git a/server/scanner/Scanner.js b/server/scanner/Scanner.js index 20d7a302..e0604123 100644 --- a/server/scanner/Scanner.js +++ b/server/scanner/Scanner.js @@ -850,7 +850,7 @@ class Scanner { // Add or set series if not set if (matchData.series && (!libraryItem.media.metadata.seriesName || options.overrideDetails)) { - if (!Array.isArray(matchData.series)) matchData.series = [{ series: matchData.series, volumeNumber: matchData.volumeNumber }] + if (!Array.isArray(matchData.series)) matchData.series = [{ series: matchData.series, sequence: matchData.sequence }] const seriesPayload = [] for (let index = 0; index < matchData.series.length; index++) { const seriesMatchItem = matchData.series[index] @@ -861,7 +861,7 @@ class Scanner { await this.db.insertEntity('series', seriesItem) this.emitter('series_added', seriesItem) } - seriesPayload.push(seriesItem.toJSONMinimal(seriesMatchItem.volumeNumber)) + seriesPayload.push(seriesItem.toJSONMinimal(seriesMatchItem.sequence)) } updatePayload.metadata.series = seriesPayload }