~ghost08/photon

Use the author field on the card if it exists v1 PROPOSED

Cowington Post: 1
 Use the author field on the card if it exists

 1 files changed, 22 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~ghost08/photon/patches/41077/mbox | git am -3
Learn more about email & git

[PATCH] Use the author field on the card if it exists Export this patch

Before this, the rss feed title is used on the card but rss feeds
sometimes have an author field on an entry, so if that exists, we use
that instead.
---
 card.go | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/card.go b/card.go
index 7a94ca7..92ed47b 100644
--- a/card.go
+++ b/card.go
@@ -76,7 +76,28 @@ func (c *Card) Draw(ctx Context, s tcell.Screen, sixelScreen *imgproc.SixelScree
		}
	}
	drawLinesWordwrap(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y, ctx.Width-3, 2, c.Item.Title, style.Bold(true))
	drawLine(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y+2, ctx.Width-3, c.Feed.Title, style.Italic(true))

	var author string
	switch len(c.Item.Authors) {
	case 0:
		author = c.Feed.Title
		break
	case 1:
		author = c.Item.Authors[0].Name
		break
	default:
		for i, item := range c.Item.Authors {
			author += item.Name
			if i-1 == len(c.Item.Authors) {
				author += ", and "
			} else {
				author += ", "
			}
		}
		break
	}
	drawLine(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y+2, ctx.Width-3, author, style.Italic(true))

	drawLine(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y+3, ctx.Width-3, htime.Difference(time.Now(), *c.Item.PublishedParsed), style.Italic(true))

	if c.DownloadImage(ctx) {
-- 
2.40.1
Thanks, that's a good idea.