From cfb5e909a9fbda72de2262b87bb76e7c485378fc Mon Sep 17 00:00:00 2001 From: mfcar Date: Mon, 27 Feb 2023 18:22:17 +0000 Subject: [PATCH] Improve podcast search --- .../components/widgets/AlreadyInLibraryIndicator.vue | 2 +- client/pages/library/_library/podcast/search.vue | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/components/widgets/AlreadyInLibraryIndicator.vue b/client/components/widgets/AlreadyInLibraryIndicator.vue index 53bc31b3..e765b4e2 100644 --- a/client/components/widgets/AlreadyInLibraryIndicator.vue +++ b/client/components/widgets/AlreadyInLibraryIndicator.vue @@ -1,6 +1,6 @@ diff --git a/client/pages/library/_library/podcast/search.vue b/client/pages/library/_library/podcast/search.vue index bef8280b..428441f9 100644 --- a/client/pages/library/_library/podcast/search.vue +++ b/client/pages/library/_library/podcast/search.vue @@ -155,6 +155,7 @@ export default { let podcast = this.existentPodcasts.find((p) => p.itunesId === result.id || p.title === result.title.toLowerCase()) if (podcast) { result.alreadyInLibrary = true + result.existentId = podcast.id } } this.results = results @@ -163,12 +164,16 @@ export default { }, async selectPodcast(podcast) { console.log('Selected podcast', podcast) + if(podcast.existentId){ + this.$router.push(`/item/${podcast.existentId}`) + return + } if (!podcast.feedUrl) { this.$toast.error('Invalid podcast - no feed') return } this.processing = true - var payload = await this.$axios.$post(`/api/podcasts/feed`, { rssFeed: podcast.feedUrl }).catch((error) => { + var 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 @@ -191,7 +196,8 @@ export default { this.existentPodcasts = podcasts.results.map((p) => { return { title: p.media.metadata.title.toLowerCase(), - itunesId: p.media.metadata.itunesId + itunesId: p.media.metadata.itunesId, + id: p.id } }) this.processing = false