Fix:Match tab #708

This commit is contained in:
advplyr 2022-06-09 17:56:16 -05:00
parent 2079942ccd
commit b2880ab0a9

View File

@ -365,21 +365,27 @@ export default {
else this.provider = localStorage.getItem('book-provider') || 'google' else this.provider = localStorage.getItem('book-provider') || 'google'
}, },
selectMatch(match) { selectMatch(match) {
if (match && match.series) { if (match) {
if (!match.series.length) { if (match.series) {
delete match.series if (!match.series.length) {
} else { delete match.series
match.series = match.series.map((se) => { } else {
return { match.series = match.series.map((se) => {
id: `new-${Math.floor(Math.random() * 10000)}`, return {
displayName: se.volumeNumber ? `${se.series} #${se.volumeNumber}` : se.series, id: `new-${Math.floor(Math.random() * 10000)}`,
name: se.series, displayName: se.volumeNumber ? `${se.series} #${se.volumeNumber}` : se.series,
sequence: se.volumeNumber || '' name: se.series,
} sequence: se.volumeNumber || ''
}) }
})
}
}
if (match.genres && Array.isArray(match.genres)) {
match.genres = match.genres.join(',')
} }
} }
console.log('Select Match', match)
this.selectedMatch = match this.selectedMatch = match
}, },
buildMatchUpdatePayload() { buildMatchUpdatePayload() {
@ -409,11 +415,12 @@ export default {
updatePayload.metadata.series = seriesPayload updatePayload.metadata.series = seriesPayload
} else if (key === 'author' && !this.isPodcast) { } else if (key === 'author' && !this.isPodcast) {
if (!Array.isArray(this.selectedMatch[key])) { var authors = this.selectedMatch[key]
this.selectedMatch[key] = this.selectedMatch[key].split(',').map((au) => au.trim()) if (!Array.isArray(authors)) {
authors = authors.split(',').map((au) => au.trim())
} }
var authorPayload = [] var authorPayload = []
this.selectedMatch[key].forEach((authorName) => authors.forEach((authorName) =>
authorPayload.push({ authorPayload.push({
id: `new-${Math.floor(Math.random() * 10000)}`, id: `new-${Math.floor(Math.random() * 10000)}`,
name: authorName name: authorName
@ -423,9 +430,9 @@ export default {
} else if (key === 'narrator') { } else if (key === 'narrator') {
updatePayload.metadata.narrators = [this.selectedMatch[key]] updatePayload.metadata.narrators = [this.selectedMatch[key]]
} else if (key === 'genres') { } else if (key === 'genres') {
updatePayload.metadata.genres = this.selectedMatch[key].split(',') updatePayload.metadata.genres = this.selectedMatch[key].split(',').map((v) => v.trim())
} else if (key === 'tags') { } else if (key === 'tags') {
updatePayload.tags = this.selectedMatch[key].split(',') updatePayload.tags = this.selectedMatch[key].split(',').map((v) => v.trim())
} else if (key === 'itunesId') { } else if (key === 'itunesId') {
updatePayload.metadata.itunesId = Number(this.selectedMatch[key]) updatePayload.metadata.itunesId = Number(this.selectedMatch[key])
} else { } else {
@ -441,6 +448,8 @@ export default {
if (!Object.keys(updatePayload).length) { if (!Object.keys(updatePayload).length) {
return return
} }
console.log('Match payload', updatePayload)
this.isProcessing = true this.isProcessing = true
if (updatePayload.metadata.cover) { if (updatePayload.metadata.cover) {