Add podcast add modal

This commit is contained in:
advplyr 2022-03-18 19:16:54 -05:00
parent a9b9e23f46
commit deadc63dbb
9 changed files with 212 additions and 18 deletions

View file

@ -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
}
}

View file

@ -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 {