Skip to content

Commit

Permalink
Add Podcast Owner Custom Definitions per #171
Browse files Browse the repository at this point in the history
Some users were saying their podcasts were getting rejected since
`podcast.IOwner` wasn't being set.  This PR adds that functionality
to issue #171.

* Did not disturb existing custom Author string, as users may
already be using that (wasn't sure on the backwards compatibility
with this repo).
* "Name" needed a prefix, since there was already Title and
Description.  Picked `Owner` for now.
* Added to existing Unit Test to ensure it gets set when custom
config is used.

NOTE: I do not have a way to test this as I do not use this repo.
This is just a drive-by PR to help the authors.
  • Loading branch information
eduncan911 authored and mxpv committed Oct 29, 2020
1 parent 2751c4b commit 1ae7f09
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
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
15 changes: 14 additions & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ 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" }
custom = {
cover_art = "http://img",
cover_art_quality = "high",
category = "TV",
subcategories = ["1", "2"],
explicit = true,
lang = "en",
author = "Mrs. Smith ([email protected])",
ownerName = "Mrs. Smith",
ownerEmail = "[email protected]"
}
`
path := setup(t, file)
defer os.Remove(path)
Expand Down Expand Up @@ -77,6 +87,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 ([email protected])", feed.Custom.Author)
assert.EqualValues(t, "Mrs. Smith", feed.Custom.OwnerName)
assert.EqualValues(t, "[email protected]", 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

0 comments on commit 1ae7f09

Please sign in to comment.