From 579785d2c68166b803851ba556379a7e2a64c151 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 25 Nov 2023 12:56:29 -0600 Subject: [PATCH] Add:Downloaded filter for podcast episodes #959 Fix:More menu button not working for podcasts with some episodes downloaded --- components/modals/ItemMoreMenuModal.vue | 2 +- components/tables/podcast/EpisodeRow.vue | 6 +++--- components/tables/podcast/EpisodesTable.vue | 15 +++++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/components/modals/ItemMoreMenuModal.vue b/components/modals/ItemMoreMenuModal.vue index 23a179b0..ad7198eb 100644 --- a/components/modals/ItemMoreMenuModal.vue +++ b/components/modals/ItemMoreMenuModal.vue @@ -165,7 +165,7 @@ export default { }, localEpisode() { if (this.isLocal) return this.episode - return this.episode.localEpisode + return this.episode?.localEpisode }, localEpisodeId() { return this.localEpisode?.id || null diff --git a/components/tables/podcast/EpisodeRow.vue b/components/tables/podcast/EpisodeRow.vue index 0f6797d3..fa688fba 100644 --- a/components/tables/podcast/EpisodeRow.vue +++ b/components/tables/podcast/EpisodeRow.vue @@ -132,10 +132,10 @@ export default { } }, itemProgressPercent() { - return this.itemProgress ? this.itemProgress.progress : 0 + return this.itemProgress?.progress || 0 }, userIsFinished() { - return this.itemProgress ? !!this.itemProgress.isFinished : false + return !!this.itemProgress?.isFinished }, timeRemaining() { if (this.streamIsPlaying) return 'Playing' @@ -151,7 +151,7 @@ export default { return this.$store.getters['globals/getDownloadItem'](this.libraryItemId, this.episode.id) }, localEpisodeId() { - return this.localEpisode ? this.localEpisode.id : null + return this.localEpisode?.id || null } }, methods: { diff --git a/components/tables/podcast/EpisodesTable.vue b/components/tables/podcast/EpisodesTable.vue index 3608a01e..518a1d06 100644 --- a/components/tables/podcast/EpisodesTable.vue +++ b/components/tables/podcast/EpisodesTable.vue @@ -116,6 +116,10 @@ export default { { text: 'Complete', value: 'complete' + }, + { + text: 'Downloaded', + value: 'downloaded' } ], fetchingRSSFeed: false, @@ -141,10 +145,10 @@ export default { return this.$store.state.networkConnected }, libraryItemId() { - return this.libraryItem ? this.libraryItem.id : null + return this.libraryItem?.id || null }, media() { - return this.libraryItem ? this.libraryItem.media || {} : {} + return this.libraryItem?.media || {} }, mediaMetadata() { return this.media.metadata || {} @@ -154,11 +158,14 @@ export default { }, episodesFiltered() { return this.episodesCopy.filter((ep) => { + if (this.filterKey === 'downloaded') { + return !!this.localEpisodeMap[ep.id] + } var mediaProgress = this.getEpisodeProgress(ep) if (this.filterKey === 'incomplete') { - return !mediaProgress || !mediaProgress.isFinished + return !mediaProgress?.isFinished } else if (this.filterKey === 'complete') { - return mediaProgress && mediaProgress.isFinished + return mediaProgress?.isFinished } else if (this.filterKey === 'inProgress') { return mediaProgress && !mediaProgress.isFinished } else if (this.filterKey === 'all') {