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

View File

@ -217,7 +217,7 @@ export default {
return ['Finished', 'In Progress', 'Not Started'] return ['Finished', 'In Progress', 'Not Started']
}, },
missing() { 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() { sublistItems() {
return (this[this.sublist] || []).map((item) => { return (this[this.sublist] || []).map((item) => {

View File

@ -159,6 +159,12 @@
<p class="text-base text-gray-100 whitespace-pre-line">{{ description }}</p> <p class="text-base text-gray-100 whitespace-pre-line">{{ description }}</p>
</div> </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" /> <widgets-audiobook-data v-if="tracks.length" :library-item-id="libraryItemId" :media="media" />
<tables-podcast-episodes-table v-if="isPodcast" :library-item="libraryItem" /> <tables-podcast-episodes-table v-if="isPodcast" :library-item="libraryItem" />
@ -228,6 +234,10 @@ export default {
isInvalid() { isInvalid() {
return this.libraryItem.isInvalid return this.libraryItem.isInvalid
}, },
invalidAudioFiles() {
if (this.isPodcast) return []
return this.libraryItem.media.audioFiles.filter((af) => af.invalid)
},
showPlayButton() { showPlayButton() {
if (this.isMissing || this.isInvalid) return false if (this.isMissing || this.isInvalid) return false
if (this.isPodcast) return this.podcastEpisodes.length if (this.isPodcast) return this.podcastEpisodes.length

View File

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

View File

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