diff --git a/client/components/modals/podcast/NewModal.vue b/client/components/modals/podcast/NewModal.vue index 92cbc96e..820ce875 100644 --- a/client/components/modals/podcast/NewModal.vue +++ b/client/components/modals/podcast/NewModal.vue @@ -179,7 +179,51 @@ export default { toggleSelectEpisode(index) { this.selectedEpisodes[String(index)] = !this.selectedEpisodes[String(index)] }, - submit() {}, + submit() { + var episodesToDownload = [] + if (this.episodesSelected.length) { + episodesToDownload = this.episodesSelected.map((episodeIndex) => this.episodes[Number(episodeIndex)]) + } + + const podcastPayload = { + path: this.fullPath, + folderId: this.selectedFolderId, + libraryId: this.currentLibrary.id, + media: { + metadata: { + title: this.podcast.title, + author: this.podcast.author, + description: this.podcast.description, + releaseDate: this.podcast.releaseDate, + genres: [...this.podcast.genres], + feedUrl: this.podcast.feedUrl, + imageUrl: this.podcast.imageUrl, + itunesPageUrl: this.podcast.itunesPageUrl, + itunesId: this.podcast.itunesId, + itunesArtistId: this.podcast.itunesArtistId, + language: this.podcast.language + }, + autoDownloadEpisodes: this.podcast.autoDownloadEpisodes + }, + episodesToDownload + } + console.log('Podcast payload', podcastPayload) + + this.processing = true + this.$axios + .$post('/api/podcasts', podcastPayload) + .then((libraryItem) => { + this.processing = false + this.$toast.success('Podcast created successfully') + this.show = false + this.$router.push(`/item/${libraryItem.id}`) + }) + .catch((error) => { + console.error('Failed to create podcast', error) + this.processing = false + this.$toast.error('Failed to create podcast') + }) + }, saveEpisode(episode) { console.log('Save episode', episode) }, diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 156d9f02..728cbff1 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -6,10 +6,10 @@
- +
- +
@@ -28,10 +28,11 @@

{{ title }}

-

{{ subtitle }}

+

{{ bookSubtitle }}

-

+

by {{ podcastAuthor }}

+

by {{ author }}

by Unknown

@@ -162,7 +163,6 @@ export default { console.error('Failed', error) return false }) - console.log(item) if (!item) { console.error('No item...', params.id) return redirect('/') @@ -193,6 +193,9 @@ export default { showExperimentalFeatures() { return this.$store.state.showExperimentalFeatures }, + isPodcast() { + return this.libraryItem.mediaType === 'podcast' + }, isMissing() { return this.libraryItem.isMissing }, @@ -200,7 +203,9 @@ export default { return this.libraryItem.isInvalid }, showPlayButton() { - return !this.isMissing && !this.isInvalid && this.audiobooks.length + if (this.isMissing || this.isInvalid) return false + if (this.isPodcast) return this.podcastEpisodes.length + return this.audiobooks.length }, libraryId() { return this.libraryItem.libraryId @@ -217,8 +222,8 @@ export default { mediaMetadata() { return this.media.metadata || {} }, - audiobooks() { - return this.media.audiobooks || [] + podcastEpisodes() { + return this.media.episodes || [] }, defaultAudiobook() { if (!this.audiobooks.length) return null @@ -233,12 +238,16 @@ export default { narrator() { return this.mediaMetadata.narratorName }, - subtitle() { + bookSubtitle() { + if (this.isPodcast) return null return this.mediaMetadata.subtitle }, genres() { return this.mediaMetadata.genres || [] }, + podcastAuthor() { + return this.mediaMetadata.author || '' + }, authors() { return this.mediaMetadata.authors || [] }, diff --git a/client/pages/library/_library/podcast/search.vue b/client/pages/library/_library/podcast/search.vue index d4e6ed96..4d975462 100644 --- a/client/pages/library/_library/podcast/search.vue +++ b/client/pages/library/_library/podcast/search.vue @@ -42,6 +42,16 @@