Skip to content

Commit 27e41d7

Browse files
authored
Support overwriting title, author and description of feed (#177)
Fixes #176
1 parent a4f8545 commit 27e41d7

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

pkg/config/config.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ type Filters struct {
5555
}
5656

5757
type Custom struct {
58-
CoverArt string `toml:"cover_art"`
59-
Category string `toml:"category"`
60-
Explicit bool `toml:"explicit"`
61-
Language string `toml:"lang"`
58+
CoverArt string `toml:"cover_art"`
59+
Category string `toml:"category"`
60+
Explicit bool `toml:"explicit"`
61+
Language string `toml:"lang"`
62+
Author string `toml:"author"`
63+
Title string `toml:"title"`
64+
Description string `toml:"description"`
6265
}
6366

6467
type Server struct {

pkg/feed/xml.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,29 @@ func Build(ctx context.Context, feed *model.Feed, cfg *config.Feed, provider url
3737
)
3838

3939
var (
40-
now = time.Now().UTC()
40+
now = time.Now().UTC()
41+
author = feed.Title
42+
title = feed.Title
43+
description = feed.Description
4144
)
4245

43-
p := itunes.New(feed.Title, feed.ItemURL, feed.Description, &feed.PubDate, &now)
46+
if cfg.Custom.Author != "" {
47+
author = cfg.Custom.Author
48+
}
49+
50+
if cfg.Custom.Title != "" {
51+
title = cfg.Custom.Title
52+
}
53+
54+
if cfg.Custom.Description != "" {
55+
description = cfg.Custom.Description
56+
}
57+
58+
p := itunes.New(title, feed.ItemURL, description, &feed.PubDate, &now)
4459
p.Generator = podsyncGenerator
45-
p.AddSubTitle(feed.Title)
46-
p.IAuthor = feed.Title
47-
p.AddSummary(feed.Description)
60+
p.AddSubTitle(title)
61+
p.IAuthor = author
62+
p.AddSummary(description)
4863

4964
if cfg.Custom.CoverArt != "" {
5065
p.AddImage(cfg.Custom.CoverArt)

0 commit comments

Comments
 (0)