diff --git a/components/bookshelf/Shelf.vue b/components/bookshelf/Shelf.vue index 6f6e7b3e..4c24ae5d 100644 --- a/components/bookshelf/Shelf.vue +++ b/components/bookshelf/Shelf.vue @@ -3,6 +3,7 @@
diff --git a/components/cards/LazyBookCard.vue b/components/cards/LazyBookCard.vue index 1febec32..da8207f2 100644 --- a/components/cards/LazyBookCard.vue +++ b/components/cards/LazyBookCard.vue @@ -34,8 +34,13 @@
+ +
+ {{ streamIsPlaying ? 'pause_circle' : 'play_circle_filled' }} +
+ -
+
{{ isLocalOnly ? 'task' : 'download_done' }} @@ -46,13 +51,18 @@ priority_high
- +

#{{ seriesSequence }}

+ +
+

Episode #{{ recentEpisodeNumber }}

+
+ -
+

{{ numEpisodes }}

@@ -196,6 +206,17 @@ export default { seriesSequence() { return this.series ? this.series.sequence : null }, + recentEpisode() { + // Only added to item when getting currently listening podcasts + return this._libraryItem.recentEpisode + }, + recentEpisodeNumber() { + if (!this.recentEpisode) return null + if (this.recentEpisode.episode) { + return this.recentEpisode.episode.replace(/^#/, '') + } + return this.recentEpisode.index + }, collapsedSeries() { // Only added to item object when collapseSeries is enabled return this._libraryItem.collapsedSeries @@ -222,7 +243,14 @@ export default { if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size) return null }, + episodeProgress() { + // Only used on home page currently listening podcast shelf + if (!this.recentEpisode) return null + if (this.isLocal) return this.store.getters['globals/getLocalMediaProgressById'](this.libraryItemId, this.recentEpisode.id) + return this.store.getters['user/getUserMediaProgress'](this.libraryItemId, this.recentEpisode.id) + }, userProgress() { + if (this.episodeProgress) return this.episodeProgress if (this.isLocal) return this.store.getters['globals/getLocalMediaProgressById'](this.libraryItemId) return this.store.getters['user/getUserMediaProgress'](this.libraryItemId) }, @@ -233,19 +261,28 @@ export default { return this.userProgress ? !!this.userProgress.isFinished : false }, showError() { - return this.hasMissingParts || this.hasInvalidParts || this.isMissing || this.isInvalid + return this.numMissingParts || this.isMissing || this.isInvalid + }, + playerIsLocal() { + return !!this.$store.state.playerIsLocal + }, + localLibraryItemId() { + if (this.isLocal) return this.libraryItemId + return this.localLibraryItem ? this.localLibraryItem.id : null }, isStreaming() { - return this.store.getters['getlibraryItemIdStreaming'] === this.libraryItemId + if (this.isPodcast) { + if (this.playerIsLocal) { + // Check is streaming local version of this episode + return false // episode cards not implemented for local yet + } + return this.$store.getters['getIsEpisodeStreaming'](this.libraryItemId, this.recentEpisode.id) + } else { + return false // not yet necessary for books + } }, - showReadButton() { - return !this.isSelectionMode && this.showExperimentalFeatures && !this.showPlayButton && this.hasEbook - }, - showPlayButton() { - return !this.isSelectionMode && !this.isMissing && !this.isInvalid && this.numTracks && !this.isStreaming - }, - showSmallEBookIcon() { - return !this.isSelectionMode && this.showExperimentalFeatures && this.hasEbook + streamIsPlaying() { + return this.$store.state.playerIsPlaying && this.isStreaming }, isMissing() { return this._libraryItem.isMissing @@ -253,24 +290,9 @@ export default { isInvalid() { return this._libraryItem.isInvalid }, - hasMissingParts() { - return this._libraryItem.hasMissingParts - }, - hasInvalidParts() { - return this._libraryItem.hasInvalidParts - }, - errorText() { - if (this.isMissing) return 'Item directory is missing!' - else if (this.isInvalid) return 'Item has no media files' - var txt = '' - if (this.hasMissingParts) { - txt = `${this.hasMissingParts} missing parts.` - } - if (this.hasInvalidParts) { - if (this.hasMissingParts) txt += ' ' - txt += `${this.hasInvalidParts} invalid parts.` - } - return txt || 'Unknown Error' + numMissingParts() { + if (this.isPodcast) return 0 + return this.media.numMissingParts }, overlayWrapperClasslist() { var classes = [] @@ -343,6 +365,10 @@ export default { e.stopPropagation() e.preventDefault() this.selectBtnClick() + } else if (this.recentEpisode) { + var eventBus = this.$eventBus || this.$nuxt.$eventBus + if (this.streamIsPlaying) eventBus.$emit('pause-item') + else eventBus.$emit('play-item', { libraryItemId: this.libraryItemId, episodeId: this.recentEpisode.id }) } else { var router = this.$router || this.$nuxt.$router if (router) { diff --git a/components/covers/BookCover.vue b/components/covers/BookCover.vue index 32ad2f3c..8b530040 100644 --- a/components/covers/BookCover.vue +++ b/components/covers/BookCover.vue @@ -5,7 +5,7 @@
- +

{{ title }}