Skip to content

Commit

Permalink
Support overwriting title, author and description of feed (#177)
Browse files Browse the repository at this point in the history
Fixes #176
  • Loading branch information
pagdot authored Oct 1, 2020
1 parent a4f8545 commit 27e41d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
11 changes: 7 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ type Filters struct {
}

type Custom struct {
CoverArt string `toml:"cover_art"`
Category string `toml:"category"`
Explicit bool `toml:"explicit"`
Language string `toml:"lang"`
CoverArt string `toml:"cover_art"`
Category string `toml:"category"`
Explicit bool `toml:"explicit"`
Language string `toml:"lang"`
Author string `toml:"author"`
Title string `toml:"title"`
Description string `toml:"description"`
}

type Server struct {
Expand Down
25 changes: 20 additions & 5 deletions pkg/feed/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,29 @@ func Build(ctx context.Context, feed *model.Feed, cfg *config.Feed, provider url
)

var (
now = time.Now().UTC()
now = time.Now().UTC()
author = feed.Title
title = feed.Title
description = feed.Description
)

p := itunes.New(feed.Title, feed.ItemURL, feed.Description, &feed.PubDate, &now)
if cfg.Custom.Author != "" {
author = cfg.Custom.Author
}

if cfg.Custom.Title != "" {
title = cfg.Custom.Title
}

if cfg.Custom.Description != "" {
description = cfg.Custom.Description
}

p := itunes.New(title, feed.ItemURL, description, &feed.PubDate, &now)
p.Generator = podsyncGenerator
p.AddSubTitle(feed.Title)
p.IAuthor = feed.Title
p.AddSummary(feed.Description)
p.AddSubTitle(title)
p.IAuthor = author
p.AddSummary(description)

if cfg.Custom.CoverArt != "" {
p.AddImage(cfg.Custom.CoverArt)
Expand Down

0 comments on commit 27e41d7

Please sign in to comment.