From e76f43f4d4447c8c90dc4fc333acb53554a874c5 Mon Sep 17 00:00:00 2001 From: Matej Drobnic Date: Sat, 2 Apr 2022 10:28:22 +0200 Subject: [PATCH] add support to set feed as private --- config.toml.example | 3 +++ pkg/builder/youtube.go | 1 + pkg/feed/config.go | 2 ++ pkg/feed/xml.go | 4 ++++ pkg/model/feed.go | 1 + 5 files changed, 11 insertions(+) diff --git a/config.toml.example b/config.toml.example index 72dbab0..5b49a1c 100644 --- a/config.toml.example +++ b/config.toml.example @@ -63,6 +63,9 @@ vimeo = [ # Multiple keys will be rotated. # Note that setting '--audio-format' for audio format feeds, or '--format' or '--output' for any format may cause # unexpected behaviour. You should only use this if you know what you are doing, and have read up on youtube-dl's options! youtube_dl_args = ["--write-sub", "--embed-subs", "--sub-lang", "en,en-US,en-GB"] + + # When set to true, podcasts indexers such as iTunes or Google Podcasts will not index this podcast + private_feed = true # Optional feed customizations [feeds.ID1.custom] diff --git a/pkg/builder/youtube.go b/pkg/builder/youtube.go index 1d47682..6cc9b0e 100644 --- a/pkg/builder/youtube.go +++ b/pkg/builder/youtube.go @@ -399,6 +399,7 @@ func (yt *YouTubeBuilder) Build(ctx context.Context, cfg *feed.Config) (*model.F CoverArtQuality: cfg.Custom.CoverArtQuality, PageSize: cfg.PageSize, PlaylistSort: cfg.PlaylistSort, + PrivateFeed: cfg.PrivateFeed, UpdatedAt: time.Now().UTC(), } diff --git a/pkg/feed/config.go b/pkg/feed/config.go index 49bc5b2..961f250 100644 --- a/pkg/feed/config.go +++ b/pkg/feed/config.go @@ -40,6 +40,8 @@ type Config struct { OPML bool `toml:"opml"` // Playlist sort PlaylistSort model.Sorting `toml:"playlist_sort"` + // Private feed (not indexed by podcast aggregators) + PrivateFeed bool `toml:"private_feed"` } type Filters struct { diff --git a/pkg/feed/xml.go b/pkg/feed/xml.go index 7d5d959..bbafd2a 100644 --- a/pkg/feed/xml.go +++ b/pkg/feed/xml.go @@ -61,6 +61,10 @@ func Build(_ctx context.Context, feed *model.Feed, cfg *Config, hostname string) p.IAuthor = author p.AddSummary(description) + if (feed.PrivateFeed) { + p.IBlock = "yes" + } + if cfg.Custom.OwnerName != "" && cfg.Custom.OwnerEmail != "" { p.IOwner = &itunes.Author{ Name: cfg.Custom.OwnerName, diff --git a/pkg/model/feed.go b/pkg/model/feed.go index 6df79e0..7c79e1b 100644 --- a/pkg/model/feed.go +++ b/pkg/model/feed.go @@ -63,6 +63,7 @@ type Feed struct { Episodes []*Episode `json:"-"` // Array of episodes UpdatedAt time.Time `json:"updated_at"` PlaylistSort Sorting `json:"playlist_sort"` + PrivateFeed bool `json:"private_feed"` } type EpisodeStatus string