mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Basic YouTube feed customization
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user