diff --git a/Readme.md b/Readme.md index 34f8c7b..cf16aa7 100644 --- a/Readme.md +++ b/Readme.md @@ -14,7 +14,7 @@ -->
Current Version -2021.09.20
+Current Version -2021.10.01
A self-hosted podcast manager to download episodes as soon as they become live diff --git a/client/index.html b/client/index.html index 766e695..a5d6b4b 100644 --- a/client/index.html +++ b/client/index.html @@ -327,7 +327,7 @@
Current Version | -2021.09.20 | +2021.10.01 |
Website | diff --git a/controllers/podcast.go b/controllers/podcast.go index 5fb7282..e0688c3 100644 --- a/controllers/podcast.go +++ b/controllers/podcast.go @@ -487,6 +487,28 @@ func createRss(items []db.PodcastItem, title, description string, c *gin.Context } } +func GetRssForPodcastById(c *gin.Context) { + var searchByIdQuery SearchByIdQuery + if c.ShouldBindUri(&searchByIdQuery) == nil { + var podcast db.Podcast + err:=db.GetPodcastById(searchByIdQuery.Id,&podcast) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request"}) + } + var podIds []string + podIds = append(podIds, searchByIdQuery.Id) + items := *service.GetAllPodcastItemsByPodcastIds(podIds) + + description := podcast.Summary + title := podcast.Title + + if err == nil { + c.XML(200, createRss(items, title, description, c)) + } + } else { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request"}) + } +} func GetRssForTagById(c *gin.Context) { var searchByIdQuery SearchByIdQuery if c.ShouldBindUri(&searchByIdQuery) == nil { diff --git a/main.go b/main.go index 0fcdbe0..426c820 100644 --- a/main.go +++ b/main.go @@ -159,6 +159,7 @@ func main() { router.DELETE("/podcasts/:id/podcast", controllers.DeleteOnlyPodcastById) router.GET("/podcasts/:id/pause", controllers.PausePodcastById) router.GET("/podcasts/:id/unpause", controllers.UnpausePodcastById) + router.GET("/podcasts/:id/rss", controllers.GetRssForPodcastById) router.GET("/podcastitems", controllers.GetAllPodcastItems) router.GET("/podcastitems/:id", controllers.GetPodcastItemById)