From d86a3b3dc21f319b6f5d473918a45e7805cbd5cf Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 1 Jul 2023 09:00:40 -0500 Subject: [PATCH] Update:Filter out podcasts from search that dont have an RSS feed url #1514 --- client/pages/library/_library/podcast/search.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/pages/library/_library/podcast/search.vue b/client/pages/library/_library/podcast/search.vue index 428441f9..cde84468 100644 --- a/client/pages/library/_library/podcast/search.vue +++ b/client/pages/library/_library/podcast/search.vue @@ -22,7 +22,7 @@
{{ podcast.title }} - +

by {{ podcast.artistName }}

{{ podcast.genres.join(', ') }}

@@ -146,11 +146,15 @@ export default { async submitSearch(term) { this.processing = true this.termSearched = '' - var results = await this.$axios.$get(`/api/search/podcast?term=${encodeURIComponent(term)}`).catch((error) => { + let results = await this.$axios.$get(`/api/search/podcast?term=${encodeURIComponent(term)}`).catch((error) => { console.error('Search request failed', error) return [] }) console.log('Got results', results) + + // Filter out podcasts without an RSS feed + results = results.filter((r) => r.feedUrl) + for (let result of results) { let podcast = this.existentPodcasts.find((p) => p.itunesId === result.id || p.title === result.title.toLowerCase()) if (podcast) { @@ -164,7 +168,7 @@ export default { }, async selectPodcast(podcast) { console.log('Selected podcast', podcast) - if(podcast.existentId){ + if (podcast.existentId) { this.$router.push(`/item/${podcast.existentId}`) return } @@ -173,7 +177,7 @@ export default { return } this.processing = true - var payload = await this.$axios.$post(`/api/podcasts/feed`, {rssFeed: podcast.feedUrl}).catch((error) => { + const payload = await this.$axios.$post(`/api/podcasts/feed`, { rssFeed: podcast.feedUrl }).catch((error) => { console.error('Failed to get feed', error) this.$toast.error('Failed to get podcast feed') return null