From deadc63dbb17f219f9aae5209060dfae5e03a7b3 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 18 Mar 2022 19:16:54 -0500 Subject: [PATCH] Add podcast add modal --- .../components/app/BookShelfCategorized.vue | 2 +- client/components/app/LazyBookshelf.vue | 4 +- client/components/app/SideRail.vue | 12 +- client/components/modals/podcast/NewModal.vue | 177 ++++++++++++++++++ client/components/ui/Btn.vue | 2 +- .../pages/library/_library/podcast/search.vue | 11 +- server/objects/mediaTypes/Podcast.js | 10 +- server/objects/metadata/PodcastMetadata.js | 11 +- server/utils/podcastUtils.js | 1 - 9 files changed, 212 insertions(+), 18 deletions(-) create mode 100644 client/components/modals/podcast/NewModal.vue diff --git a/client/components/app/BookShelfCategorized.vue b/client/components/app/BookShelfCategorized.vue index 32d3d085..e5527eb0 100644 --- a/client/components/app/BookShelfCategorized.vue +++ b/client/components/app/BookShelfCategorized.vue @@ -8,7 +8,7 @@
-

Audiobookshelf is empty!

+

Library is empty!

Configure Scanner Scan Library diff --git a/client/components/app/LazyBookshelf.vue b/client/components/app/LazyBookshelf.vue index 46ef22d3..ed4e2b22 100644 --- a/client/components/app/LazyBookshelf.vue +++ b/client/components/app/LazyBookshelf.vue @@ -7,10 +7,10 @@
-

Audiobookshelf is empty!

+

Library is empty!

Configure Scanner - Scan Audiobooks + Scan Library
diff --git a/client/components/app/SideRail.vue b/client/components/app/SideRail.vue index 77e32c55..8c0a4655 100644 --- a/client/components/app/SideRail.vue +++ b/client/components/app/SideRail.vue @@ -21,7 +21,7 @@
- + @@ -31,7 +31,7 @@
- + collections_bookmark

Collections

@@ -39,7 +39,7 @@
- + - - + +

Search

@@ -92,7 +92,7 @@ export default { return this.$store.getters['libraries/getCurrentLibraryMediaType'] }, isPodcastLibrary() { - return this.currentLibraryMediaType === 'podcasts' + return this.currentLibraryMediaType === 'podcast' }, isPodcastSearchPage() { return this.$route.name === 'library-library-podcast-search' diff --git a/client/components/modals/podcast/NewModal.vue b/client/components/modals/podcast/NewModal.vue new file mode 100644 index 00000000..4fd6a951 --- /dev/null +++ b/client/components/modals/podcast/NewModal.vue @@ -0,0 +1,177 @@ + + + + + \ No newline at end of file diff --git a/client/components/ui/Btn.vue b/client/components/ui/Btn.vue index 2488b244..b1d8a158 100644 --- a/client/components/ui/Btn.vue +++ b/client/components/ui/Btn.vue @@ -1,5 +1,5 @@ @@ -45,7 +47,11 @@ export default { searchTerm: '', results: [], termSearched: '', - processing: false + processing: false, + + showNewPodcastModal: false, + selectedPodcast: null, + selectedPodcastFeed: null } }, computed: { @@ -83,6 +89,9 @@ export default { }) this.processing = false if (!podcastfeed) return + this.selectedPodcastFeed = podcastfeed + this.selectedPodcast = podcast + this.showNewPodcastModal = true console.log('Got podcast feed', podcastfeed) } }, diff --git a/server/objects/mediaTypes/Podcast.js b/server/objects/mediaTypes/Podcast.js index 946ac677..3c17939f 100644 --- a/server/objects/mediaTypes/Podcast.js +++ b/server/objects/mediaTypes/Podcast.js @@ -11,6 +11,8 @@ class Podcast { this.tags = [] this.episodes = [] + this.autoDownloadEpisodes = false + this.lastCoverSearch = null this.lastCoverSearchQuery = null @@ -25,6 +27,7 @@ class Podcast { this.coverPath = podcast.coverPath this.tags = [...podcast.tags] this.episodes = podcast.episodes.map((e) => new PodcastEpisode(e)) + this.autoDownloadEpisodes = !!podcast.autoDownloadEpisodes } toJSON() { @@ -34,6 +37,7 @@ class Podcast { coverPath: this.coverPath, tags: [...this.tags], episodes: this.episodes.map(e => e.toJSON()), + autoDownloadEpisodes: this.autoDownloadEpisodes } } @@ -43,7 +47,8 @@ class Podcast { metadata: this.metadata.toJSON(), coverPath: this.coverPath, tags: [...this.tags], - episodes: this.episodes.map(e => e.toJSON()) + episodes: this.episodes.map(e => e.toJSON()), + autoDownloadEpisodes: this.autoDownloadEpisodes } } @@ -53,7 +58,8 @@ class Podcast { metadata: this.metadata.toJSONExpanded(), coverPath: this.coverPath, tags: [...this.tags], - episodes: this.episodes.map(e => e.toJSON()) + episodes: this.episodes.map(e => e.toJSON()), + autoDownloadEpisodes: this.autoDownloadEpisodes } } diff --git a/server/objects/metadata/PodcastMetadata.js b/server/objects/metadata/PodcastMetadata.js index e6e2a74d..face9e6a 100644 --- a/server/objects/metadata/PodcastMetadata.js +++ b/server/objects/metadata/PodcastMetadata.js @@ -1,11 +1,12 @@ class PodcastMetadata { constructor(metadata) { this.title = null - this.artist = null + this.author = null this.description = null this.releaseDate = null this.genres = [] this.feedUrl = null + this.feedImageUrl = null this.itunesPageUrl = null this.itunesId = null this.itunesArtistId = null @@ -18,11 +19,12 @@ class PodcastMetadata { construct(metadata) { this.title = metadata.title - this.artist = metadata.artist + this.author = metadata.author this.description = metadata.description this.releaseDate = metadata.releaseDate this.genres = [...metadata.genres] this.feedUrl = metadata.feedUrl + this.feedImageUrl = metadata.feedImageUrl this.itunesPageUrl = metadata.itunesPageUrl this.itunesId = metadata.itunesId this.itunesArtistId = metadata.itunesArtistId @@ -32,11 +34,12 @@ class PodcastMetadata { toJSON() { return { title: this.title, - artist: this.artist, + author: this.author, description: this.description, releaseDate: this.releaseDate, genres: [...this.genres], feedUrl: this.feedUrl, + feedImageUrl: this.feedImageUrl, itunesPageUrl: this.itunesPageUrl, itunesId: this.itunesId, itunesArtistId: this.itunesArtistId, @@ -53,7 +56,7 @@ class PodcastMetadata { } searchQuery(query) { // Returns key if match is found - var keysToCheck = ['title', 'artist', 'itunesId', 'itunesArtistId'] + var keysToCheck = ['title', 'author', 'itunesId', 'itunesArtistId'] for (var key of keysToCheck) { if (this[key] && String(this[key]).toLowerCase().includes(query)) { return { diff --git a/server/utils/podcastUtils.js b/server/utils/podcastUtils.js index d0a2e607..5d98d6ad 100644 --- a/server/utils/podcastUtils.js +++ b/server/utils/podcastUtils.js @@ -91,7 +91,6 @@ function cleanPodcastJson(rssJson) { Logger.error(`[podcastUtil] Invalid podcast no episodes`) return null } - var podcast = { metadata: extractPodcastMetadata(channel), episodes: extractPodcastEpisodes(channel.item)