diff --git a/pkg/builders/youtube.go b/pkg/builders/youtube.go index ac285b8..8e46b20 100644 --- a/pkg/builders/youtube.go +++ b/pkg/builders/youtube.go @@ -201,6 +201,16 @@ func (yt *YouTubeBuilder) queryFeed(feed *model.Feed) (*itunes.Podcast, string, desc = fmt.Sprintf("%s (%s)", title, pubDate) } + var ( + image string + ) + + if feed.CoverArt != "" { + image = feed.CoverArt + } else { + image = yt.selectThumbnail(thumbnails, feed.Quality) + } + // Build iTunes feed buildTime := time.Now() podcast := itunes.New(title, link, desc, &pubDate, &buildTime) @@ -208,7 +218,7 @@ func (yt *YouTubeBuilder) queryFeed(feed *model.Feed) (*itunes.Podcast, string, podcast.AddSubTitle(title) podcast.AddCategory(defaultCategory, nil) - podcast.AddImage(yt.selectThumbnail(thumbnails, feed.Quality)) + podcast.AddImage(image) podcast.IAuthor = title podcast.AddSummary(desc) @@ -252,11 +262,11 @@ func (yt *YouTubeBuilder) queryVideoDescriptions(playlistItems map[string]*youtu snippet := video.Snippet item := itunes.Item{ - GUID: video.Id, - Link: fmt.Sprintf("https://youtube.com/watch?v=%s", video.Id), - Title: snippet.Title, + GUID: video.Id, + Link: fmt.Sprintf("https://youtube.com/watch?v=%s", video.Id), + Title: snippet.Title, Description: snippet.Description, - ISubtitle: snippet.Title, + ISubtitle: snippet.Title, } desc := snippet.Description @@ -303,6 +313,12 @@ func (yt *YouTubeBuilder) queryVideoDescriptions(playlistItems map[string]*youtu item.Description = " " } + if feed.Explicit { + item.IExplicit = "true" + } else { + item.IExplicit = "false" + } + item.IOrder = strconv.FormatInt(playlistItem.Position, 10) _, err = podcast.AddItem(item) diff --git a/pkg/model/model.go b/pkg/model/model.go index 9e5be12..fc16963 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -33,4 +33,6 @@ type Feed struct { CreatedAt time.Time `dynamodbav:",unixtime"` LastAccess time.Time `dynamodbav:",unixtime"` ExpirationTime time.Time `sql:"-" dynamodbav:",unixtime"` + CoverArt string `dynamodbav:",omitempty"` + Explicit bool }