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:
@@ -249,6 +249,12 @@ func (yt *YouTubeBuilder) queryVideoDescriptions(ids []string, feed *api.Feed, p
|
|||||||
size := yt.getVideoSize(video.ContentDetails.Definition, seconds, feed.Format)
|
size := yt.getVideoSize(video.ContentDetails.Definition, seconds, feed.Format)
|
||||||
item.AddEnclosure(makeEnclosure(feed, video.Id, size))
|
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)
|
_, err = podcast.AddItem(item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to add item to podcast (id '%s')", video.Id)
|
return errors.Wrapf(err, "failed to add item to podcast (id '%s')", video.Id)
|
||||||
|
@@ -217,13 +217,15 @@ Host: www.podsync.net`)
|
|||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
if err == api.ErrNotFound {
|
if err == api.ErrNotFound {
|
||||||
code = http.StatusNotFound
|
code = http.StatusNotFound
|
||||||
|
} else {
|
||||||
|
log.Printf("server error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.String(code, err.Error())
|
c.String(code, err.Error())
|
||||||
return
|
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) {
|
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{}) {
|
func internalError(err error) (int, interface{}) {
|
||||||
|
log.Printf("server error: %v", err)
|
||||||
return http.StatusInternalServerError, gin.H{"error": err.Error()}
|
return http.StatusInternalServerError, gin.H{"error": err.Error()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user