mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-02 20:19:10 +01:00
Cleaned series match & renaming volumeNumber to sequence
This commit is contained in:
parent
c23f31216a
commit
14e5e11344
@ -19,7 +19,7 @@
|
|||||||
<div v-if="book.series && book.series.length" class="flex py-1 -mx-1">
|
<div v-if="book.series && book.series.length" class="flex py-1 -mx-1">
|
||||||
<div v-for="(series, index) in book.series" :key="index" class="bg-white bg-opacity-10 rounded-full px-1 py-0.5 mx-1">
|
<div v-for="(series, index) in book.series" :key="index" class="bg-white bg-opacity-10 rounded-full px-1 py-0.5 mx-1">
|
||||||
<p class="leading-3 text-xs text-gray-400">
|
<p class="leading-3 text-xs text-gray-400">
|
||||||
{{ series.series }}<span v-if="series.volumeNumber"> #{{ series.volumeNumber }}</span>
|
{{ series.series }}<span v-if="series.sequence"> #{{ series.sequence }}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -182,7 +182,8 @@ export default {
|
|||||||
return this.mediaType === 'podcast'
|
return this.mediaType === 'podcast'
|
||||||
},
|
},
|
||||||
placeholderUrl() {
|
placeholderUrl() {
|
||||||
return `${this.$config.routerBasePath}/book_placeholder.jpg`
|
const config = this.$config || this.$nuxt.$config
|
||||||
|
return `${config.routerBasePath}/book_placeholder.jpg`
|
||||||
},
|
},
|
||||||
bookCoverSrc() {
|
bookCoverSrc() {
|
||||||
return this.store.getters['globals/getLibraryItemCoverSrc'](this._libraryItem, this.placeholderUrl)
|
return this.store.getters['globals/getLibraryItemCoverSrc'](this._libraryItem, this.placeholderUrl)
|
||||||
|
@ -100,10 +100,6 @@
|
|||||||
<p v-if="mediaMetadata.seriesName" class="text-xs ml-1 text-white text-opacity-60">Currently: {{ mediaMetadata.seriesName || '' }}</p>
|
<p v-if="mediaMetadata.seriesName" class="text-xs ml-1 text-white text-opacity-60">Currently: {{ mediaMetadata.seriesName || '' }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="selectedMatchOrig.volumeNumber" class="flex items-center py-2">
|
|
||||||
<ui-checkbox v-model="selectedMatchUsage.volumeNumber" @input="checkboxToggled" />
|
|
||||||
<ui-text-input-with-label v-model="selectedMatch.volumeNumber" :disabled="!selectedMatchUsage.volumeNumber" label="Volume Number" class="flex-grow ml-4" />
|
|
||||||
</div>
|
|
||||||
<div v-if="selectedMatchOrig.genres && selectedMatchOrig.genres.length" class="flex items-center py-2">
|
<div v-if="selectedMatchOrig.genres && selectedMatchOrig.genres.length" class="flex items-center py-2">
|
||||||
<ui-checkbox v-model="selectedMatchUsage.genres" checkbox-bg="bg" @input="checkboxToggled" />
|
<ui-checkbox v-model="selectedMatchUsage.genres" checkbox-bg="bg" @input="checkboxToggled" />
|
||||||
<div class="flex-grow ml-4">
|
<div class="flex-grow ml-4">
|
||||||
@ -208,7 +204,6 @@ export default {
|
|||||||
publisher: true,
|
publisher: true,
|
||||||
publishedYear: true,
|
publishedYear: true,
|
||||||
series: true,
|
series: true,
|
||||||
volumeNumber: true,
|
|
||||||
genres: true,
|
genres: true,
|
||||||
tags: true,
|
tags: true,
|
||||||
language: true,
|
language: true,
|
||||||
@ -246,9 +241,9 @@ export default {
|
|||||||
return this.selectedMatch.series.map((se) => {
|
return this.selectedMatch.series.map((se) => {
|
||||||
return {
|
return {
|
||||||
id: `new-${Math.floor(Math.random() * 10000)}`,
|
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,
|
name: se.series,
|
||||||
sequence: se.volumeNumber || ''
|
sequence: se.sequence || ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -353,7 +348,6 @@ export default {
|
|||||||
publisher: true,
|
publisher: true,
|
||||||
publishedYear: true,
|
publishedYear: true,
|
||||||
series: true,
|
series: true,
|
||||||
volumeNumber: true,
|
|
||||||
genres: true,
|
genres: true,
|
||||||
tags: true,
|
tags: true,
|
||||||
language: true,
|
language: true,
|
||||||
@ -396,9 +390,9 @@ export default {
|
|||||||
match.series = match.series.map((se) => {
|
match.series = match.series.map((se) => {
|
||||||
return {
|
return {
|
||||||
id: `new-${Math.floor(Math.random() * 10000)}`,
|
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,
|
name: se.series,
|
||||||
sequence: se.volumeNumber || ''
|
sequence: se.sequence || ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -417,18 +411,13 @@ export default {
|
|||||||
var updatePayload = {}
|
var updatePayload = {}
|
||||||
updatePayload.metadata = {}
|
updatePayload.metadata = {}
|
||||||
|
|
||||||
var volumeNumber = this.selectedMatchUsage.volumeNumber ? this.selectedMatch.volumeNumber || null : null
|
|
||||||
for (const key in this.selectedMatchUsage) {
|
for (const key in this.selectedMatchUsage) {
|
||||||
if (this.selectedMatchUsage[key] && this.selectedMatch[key]) {
|
if (this.selectedMatchUsage[key] && this.selectedMatch[key]) {
|
||||||
if (key === 'series') {
|
if (key === 'series') {
|
||||||
var seriesPayload = []
|
|
||||||
if (!Array.isArray(this.selectedMatch[key])) {
|
if (!Array.isArray(this.selectedMatch[key])) {
|
||||||
seriesPayload.push({
|
console.error('Invalid series in selectedMatch', this.selectedMatch[key])
|
||||||
id: `new-${Math.floor(Math.random() * 10000)}`,
|
|
||||||
name: this.selectedMatch[key],
|
|
||||||
sequence: volumeNumber
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
|
var seriesPayload = []
|
||||||
this.selectedMatch[key].forEach((seriesItem) =>
|
this.selectedMatch[key].forEach((seriesItem) =>
|
||||||
seriesPayload.push({
|
seriesPayload.push({
|
||||||
id: seriesItem.id,
|
id: seriesItem.id,
|
||||||
@ -436,9 +425,8 @@ export default {
|
|||||||
sequence: seriesItem.sequence
|
sequence: seriesItem.sequence
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
updatePayload.metadata.series = seriesPayload
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePayload.metadata.series = seriesPayload
|
|
||||||
} else if (key === 'author' && !this.isPodcast) {
|
} else if (key === 'author' && !this.isPodcast) {
|
||||||
var authors = this.selectedMatch[key]
|
var authors = this.selectedMatch[key]
|
||||||
if (!Array.isArray(authors)) {
|
if (!Array.isArray(authors)) {
|
||||||
|
@ -27,7 +27,7 @@ class Audible {
|
|||||||
asin,
|
asin,
|
||||||
genres: genresFiltered.length ? genresFiltered : null,
|
genres: genresFiltered.length ? genresFiltered : null,
|
||||||
tags: tagsFiltered.length ? tagsFiltered.join(', ') : 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,
|
language: language ? language.charAt(0).toUpperCase() + language.slice(1) : null,
|
||||||
duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0
|
duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ class Scanner {
|
|||||||
|
|
||||||
// Add or set series if not set
|
// Add or set series if not set
|
||||||
if (matchData.series && (!libraryItem.media.metadata.seriesName || options.overrideDetails)) {
|
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 = []
|
const seriesPayload = []
|
||||||
for (let index = 0; index < matchData.series.length; index++) {
|
for (let index = 0; index < matchData.series.length; index++) {
|
||||||
const seriesMatchItem = matchData.series[index]
|
const seriesMatchItem = matchData.series[index]
|
||||||
@ -861,7 +861,7 @@ class Scanner {
|
|||||||
await this.db.insertEntity('series', seriesItem)
|
await this.db.insertEntity('series', seriesItem)
|
||||||
this.emitter('series_added', seriesItem)
|
this.emitter('series_added', seriesItem)
|
||||||
}
|
}
|
||||||
seriesPayload.push(seriesItem.toJSONMinimal(seriesMatchItem.volumeNumber))
|
seriesPayload.push(seriesItem.toJSONMinimal(seriesMatchItem.sequence))
|
||||||
}
|
}
|
||||||
updatePayload.metadata.series = seriesPayload
|
updatePayload.metadata.series = seriesPayload
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user