Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 13 additions & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

@eduncan911 eduncan911 Oct 28, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i figured you'd want this cleaned up and formatted a bit. :)

[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)
Expand Down Expand Up @@ -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"})

Expand Down
7 changes: 7 additions & 0 deletions pkg/feed/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down