diff --git a/client/components/tables/CollectionBooksTable.vue b/client/components/tables/CollectionBooksTable.vue index 5b9e61c7..4eaff721 100644 --- a/client/components/tables/CollectionBooksTable.vue +++ b/client/components/tables/CollectionBooksTable.vue @@ -6,7 +6,7 @@

{{ books.length }}

-

{{ totalDurationPretty }}

+
@@ -56,16 +56,6 @@ export default { }, bookCoverAspectRatio() { return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6 - }, - totalDuration() { - var _total = 0 - this.books.forEach((book) => { - _total += book.duration - }) - return _total - }, - totalDurationPretty() { - return this.$elapsedPretty(this.totalDuration) } }, methods: { diff --git a/client/components/tables/collection/BookTableRow.vue b/client/components/tables/collection/BookTableRow.vue index 4ed8fe9e..e689467f 100644 --- a/client/components/tables/collection/BookTableRow.vue +++ b/client/components/tables/collection/BookTableRow.vue @@ -17,7 +17,6 @@
{{ bookTitle }} -
@@ -89,8 +88,12 @@ export default { bookAuthor() { return (this.mediaMetadata.authors || []).map((au) => au.name).join(', ') }, + defaultAudiobook() { + if (!this.media.audiobooks.length) return null + return this.media.audiobooks[0] + }, bookDuration() { - return this.$secondsToTimestamp(this.media.duration) + return this.$secondsToTimestamp(this.defaultAudiobook.duration) }, isMissing() { return this.book.isMissing @@ -98,14 +101,11 @@ export default { isInvalid() { return this.book.isInvalid }, - numTracks() { - return this.media.tracks.length - }, isStreaming() { return this.$store.getters['getLibraryItemIdStreaming'] === this.book.id }, showPlayBtn() { - return !this.isMissing && !this.isInvalid && !this.isStreaming && this.numTracks + return !this.isMissing && !this.isInvalid && !this.isStreaming && this.defaultAudiobook }, itemProgress() { return this.$store.getters['user/getUserLibraryItemProgress'](this.book.id) diff --git a/client/pages/collection/_id.vue b/client/pages/collection/_id.vue index 7a1ba261..f69def34 100644 --- a/client/pages/collection/_id.vue +++ b/client/pages/collection/_id.vue @@ -83,7 +83,7 @@ export default { }, playableBooks() { return this.bookItems.filter((book) => { - return !book.isMissing && !book.isInvalid && book.numTracks + return !book.isMissing && !book.isInvalid && book.media.audiobooks.length }) }, streaming() { @@ -91,9 +91,6 @@ export default { }, showPlayButton() { return this.playableBooks.length - }, - userAudiobooks() { - return this.$store.state.user.user ? this.$store.state.user.user.audiobooks || {} : {} } }, methods: { @@ -118,7 +115,10 @@ export default { } }, clickPlay() { - var nextBookNotRead = this.playableBooks.find((pb) => !this.userAudiobooks[pb.id] || !this.userAudiobooks[pb.id].isRead) + var nextBookNotRead = this.playableBooks.find((pb) => { + var prog = this.$store.getters['user/getUserLibraryItemProgress'](pb.id) + return !prog || !prog.isFinished + }) if (nextBookNotRead) { this.$eventBus.$emit('play-item', nextBookNotRead.id) }