Fix: show books with invalid audio files and add error icon on book items #491

This commit is contained in:
advplyr 2022-04-24 18:05:15 -05:00
parent 5389115120
commit 4bc7cd2045
5 changed files with 27 additions and 10 deletions

View File

@ -273,7 +273,7 @@ export default {
},
showError() {
if (this.recentEpisode) return false // Dont show podcast error on episode card
return this.numMissingParts || this.isMissing || this.isInvalid
return this.numInvalidAudioFiles || this.numMissingParts || this.isMissing || this.isInvalid
},
isStreaming() {
return this.store.getters['getlibraryItemIdStreaming'] === this.libraryItemId
@ -297,6 +297,10 @@ export default {
if (this.isPodcast) return 0
return this.media.numMissingParts
},
numInvalidAudioFiles() {
if (this.isPodcast) return 0
return this.media.numInvalidAudioFiles
},
errorText() {
if (this.isMissing) return 'Item directory is missing!'
else if (this.isInvalid) {
@ -305,7 +309,11 @@ export default {
}
var txt = ''
if (this.numMissingParts) {
txt = `${this.numMissingParts} missing parts.`
txt += `${this.numMissingParts} missing parts.`
}
if (this.numInvalidAudioFiles) {
if (txt) txt += ' '
txt += `${this.numInvalidAudioFiles} invalid audio files.`
}
return txt || 'Unknown Error'
},

View File

@ -217,7 +217,7 @@ export default {
return ['Finished', 'In Progress', 'Not Started']
},
missing() {
return ['ASIN', 'ISBN', 'Subtitle', 'Author', 'Publish Year', 'Series', 'Volume Number', 'Description', 'Genres', 'Tags', 'Narrator', 'Publisher', 'Language']
return ['ASIN', 'ISBN', 'Subtitle', 'Author', 'Publish Year', 'Series', 'Description', 'Genres', 'Tags', 'Narrator', 'Publisher', 'Language']
},
sublistItems() {
return (this[this.sublist] || []).map((item) => {

View File

@ -159,6 +159,12 @@
<p class="text-base text-gray-100 whitespace-pre-line">{{ description }}</p>
</div>
<div v-if="invalidAudioFiles.length" class="bg-error border-red-800 shadow-md p-4">
<p class="text-sm mb-2">Invalid audio files</p>
<p v-for="audioFile in invalidAudioFiles" :key="audioFile.id" class="text-xs pl-2">- {{ audioFile.metadata.filename }} ({{ audioFile.error }})</p>
</div>
<widgets-audiobook-data v-if="tracks.length" :library-item-id="libraryItemId" :media="media" />
<tables-podcast-episodes-table v-if="isPodcast" :library-item="libraryItem" />
@ -228,6 +234,10 @@ export default {
isInvalid() {
return this.libraryItem.isInvalid
},
invalidAudioFiles() {
if (this.isPodcast) return []
return this.libraryItem.media.audioFiles.filter((af) => af.invalid)
},
showPlayButton() {
if (this.isMissing || this.isInvalid) return false
if (this.isPodcast) return this.podcastEpisodes.length

View File

@ -65,6 +65,7 @@ class Book {
numAudioFiles: this.audioFiles.length,
numChapters: this.chapters.length,
numMissingParts: this.missingParts.length,
numInvalidAudioFiles: this.invalidAudioFiles.length,
duration: this.duration,
size: this.size,
ebookFormat: this.ebookFile ? this.ebookFile.ebookFormat : null
@ -106,8 +107,11 @@ class Book {
get hasEmbeddedCoverArt() {
return this.audioFiles.some(af => af.embeddedCoverArt)
}
get invalidAudioFiles() {
return this.audioFiles.filter(af => af.invalid)
}
get hasIssues() {
return this.missingParts.length || this.audioFiles.some(af => af.invalid)
return this.missingParts.length || this.invalidAudioFiles.length
}
get tracks() {
var startOffset = 0

View File

@ -43,7 +43,6 @@ module.exports = {
if (filter === 'Author' && li.media.metadata.authors.length === 0) return true;
if (filter === 'Publish Year' && li.media.metadata.publishedYear === null) return true;
if (filter === 'Series' && li.media.metadata.series.length === 0) return true;
if (filter === 'Volume Number' && (li.media.metadata.series.length === 0 || li.media.metadata.series[0].sequence === null)) return true;
if (filter === 'Description' && li.media.metadata.description === null) return true;
if (filter === 'Genres' && li.media.metadata.genres.length === 0) return true;
if (filter === 'Tags' && li.media.tags.length === 0) return true;
@ -55,11 +54,7 @@ module.exports = {
filtered = filtered.filter(li => li.media.metadata && li.media.metadata.language === filter)
}
} else if (filterBy === 'issues') {
filtered = filtered.filter(ab => {
// TODO: Update filter for issues
return ab.isMissing || ab.isInvalid
// return ab.numMissingParts || ab.numInvalidParts || ab.isMissing || ab.isInvalid
})
filtered = filtered.filter(li => li.hasIssues)
}
return filtered