mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Add Podcast Owner Custom Definitions per #171
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.
This commit is contained in:
committed by
Maksym Pavlenko
parent
2751c4b8de
commit
1ae7f09e02
@@ -65,6 +65,8 @@ type Custom struct {
|
|||||||
Author string `toml:"author"`
|
Author string `toml:"author"`
|
||||||
Title string `toml:"title"`
|
Title string `toml:"title"`
|
||||||
Description string `toml:"description"`
|
Description string `toml:"description"`
|
||||||
|
OwnerName string `toml:"ownerName"`
|
||||||
|
OwnerEmail string `toml:"ownerEmail"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
@@ -41,7 +41,17 @@ timeout = 15
|
|||||||
quality = "low"
|
quality = "low"
|
||||||
filters = { title = "regex for title here" }
|
filters = { title = "regex for title here" }
|
||||||
clean = { keep_last = 10 }
|
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 (mrs@smith.org)",
|
||||||
|
ownerName = "Mrs. Smith",
|
||||||
|
ownerEmail = "mrs@smith.org"
|
||||||
|
}
|
||||||
`
|
`
|
||||||
path := setup(t, file)
|
path := setup(t, file)
|
||||||
defer os.Remove(path)
|
defer os.Remove(path)
|
||||||
@@ -77,6 +87,9 @@ timeout = 15
|
|||||||
assert.EqualValues(t, "TV", feed.Custom.Category)
|
assert.EqualValues(t, "TV", feed.Custom.Category)
|
||||||
assert.True(t, feed.Custom.Explicit)
|
assert.True(t, feed.Custom.Explicit)
|
||||||
assert.EqualValues(t, "en", feed.Custom.Language)
|
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"})
|
assert.EqualValues(t, feed.Custom.Subcategories, []string{"1", "2"})
|
||||||
|
|
||||||
|
@@ -61,6 +61,13 @@ func Build(ctx context.Context, feed *model.Feed, cfg *config.Feed, provider url
|
|||||||
p.IAuthor = author
|
p.IAuthor = author
|
||||||
p.AddSummary(description)
|
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 != "" {
|
if cfg.Custom.CoverArt != "" {
|
||||||
p.AddImage(cfg.Custom.CoverArt)
|
p.AddImage(cfg.Custom.CoverArt)
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user