1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Bug fixes in feed generator

This commit is contained in:
Maksym Pavlenko
2017-08-22 23:16:48 -07:00
parent 0f6ebc4907
commit 9f87308927
2 changed files with 10 additions and 1 deletions

View File

@ -249,6 +249,12 @@ func (yt *YouTubeBuilder) queryVideoDescriptions(ids []string, feed *api.Feed, p
size := yt.getVideoSize(video.ContentDetails.Definition, seconds, feed.Format)
item.AddEnclosure(makeEnclosure(feed, video.Id, size))
// podcast.AddItem requires description to be not empty, use workaround
if item.Description == "" {
item.Description = " "
}
_, err = podcast.AddItem(item)
if err != nil {
return errors.Wrapf(err, "failed to add item to podcast (id '%s')", video.Id)

View File

@ -217,13 +217,15 @@ Host: www.podsync.net`)
code := http.StatusInternalServerError
if err == api.ErrNotFound {
code = http.StatusNotFound
} else {
log.Printf("server error: %v", err)
}
c.String(code, err.Error())
return
}
c.Data(http.StatusOK, "application/rss+xml", podcast.Bytes())
c.Data(http.StatusOK, "application/rss+xml; charset=UTF-8", podcast.Bytes())
})
r.GET("/api/metadata/:hashId", func(c *gin.Context) {
@ -250,6 +252,7 @@ func badRequest(err error) (int, interface{}) {
}
func internalError(err error) (int, interface{}) {
log.Printf("server error: %v", err)
return http.StatusInternalServerError, gin.H{"error": err.Error()}
}