diff --git a/pkg/config/config.go b/pkg/config/config.go index 9052a410..6930f1dd 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -65,6 +65,8 @@ type Custom struct { Author string `toml:"author"` Title string `toml:"title"` Description string `toml:"description"` + OwnerName string `toml:"ownerName"` + OwnerEmail string `toml:"ownerEmail"` } type Server struct { diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index f71a6301..8a1694ee 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -41,7 +41,16 @@ timeout = 15 quality = "low" filters = { title = "regex for title here" } clean = { keep_last = 10 } - custom = { cover_art = "http://img", cover_art_quality = "high", category = "TV", subcategories = ["1", "2"], explicit = true, lang = "en" } + [feeds.XYZ.custom] + cover_art = "http://img" + cover_art_quality = "high" + category = "TV" + subcategories = ["1", "2"] + explicit = true + lang = "en" + author = "Mrs. Smith (mrs@smith.org)" + ownerName = "Mrs. Smith" + ownerEmail = "mrs@smith.org" ` path := setup(t, file) defer os.Remove(path) @@ -77,6 +86,9 @@ timeout = 15 assert.EqualValues(t, "TV", feed.Custom.Category) assert.True(t, feed.Custom.Explicit) assert.EqualValues(t, "en", feed.Custom.Language) + assert.EqualValues(t, "Mrs. Smith (mrs@smith.org)", feed.Custom.Author) + assert.EqualValues(t, "Mrs. Smith", feed.Custom.OwnerName) + assert.EqualValues(t, "mrs@smith.org", feed.Custom.OwnerEmail) assert.EqualValues(t, feed.Custom.Subcategories, []string{"1", "2"}) diff --git a/pkg/feed/xml.go b/pkg/feed/xml.go index c4f17ca9..40769e36 100644 --- a/pkg/feed/xml.go +++ b/pkg/feed/xml.go @@ -61,6 +61,13 @@ func Build(ctx context.Context, feed *model.Feed, cfg *config.Feed, provider url p.IAuthor = author p.AddSummary(description) + if cfg.Custom.OwnerName != "" && cfg.Custom.OwnerEmail != "" { + p.IOwner = &itunes.Author{ + Name: cfg.Custom.OwnerName, + Email: cfg.Custom.OwnerEmail, + } + } + if cfg.Custom.CoverArt != "" { p.AddImage(cfg.Custom.CoverArt) } else {