Skip to content

Commit

Permalink
Hack: use post cats when feed has none
Browse files Browse the repository at this point in the history
  • Loading branch information
robalexdev committed Jun 5, 2024
1 parent 60ee644 commit ee01be3
Show file tree
Hide file tree
Showing 503 changed files with 5,983 additions and 13,186 deletions.
26 changes: 26 additions & 0 deletions analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"slices"
"strings"

"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
Expand Down Expand Up @@ -536,6 +537,26 @@ func (a *Analysis) PopulateRecommenders(feed *FeedInfo, blogrolls []string, webs
}
}

func (a *Analysis) FixUp(feed *FeedInfo) {
// Hack: when the feed doesn't have categories, but the last post does
// use the post categories as the feed categories
if len(feed.Params.Categories) == 0 {
feed.Params.Categories = feed.Params.LastPostCategories
}

// Something in hugo breaks if there's a trailing slash
for i, c := range feed.Params.Categories {
if strings.HasSuffix(c, "/") {
feed.Params.Categories[i] = c + " "
}
}
for i, c := range feed.Params.LastPostCategories {
if strings.HasSuffix(c, "/") {
feed.Params.LastPostCategories[i] = c + " "
}
}
}

func (a *Analysis) Analyze() {
feedRows, err := a.db.Query(`
SELECT description, date, title, feed_link, feed_id, feed_type, is_podcast
Expand Down Expand Up @@ -573,6 +594,11 @@ func (a *Analysis) Analyze() {
a.PopulateCategoriesForFeed(feed)
a.PopulateLastPostForFeed(feed)
a.PopulateScore(feed)

// Apply some hacks to improve content
// but do this after the score is calculated
a.FixUp(feed)

feed.Save()
}
}
11 changes: 10 additions & 1 deletion content/discover/feed-0076f872dbc52b55c2d940f7fa48bb94.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ params:
blogrolls: []
recommended: []
recommender:
- https://danq.blog/comments/feed/
- https://danq.blog/feed/
- https://danq.me/comments/feed/
- https://danq.me/feed/
- https://danq.me/kind/article/feed/
- https://danq.me/kind/note/feed/
categories: []
- https://danq.uk/comments/feed/
- https://danq.uk/feed/
categories:
- Comic
- Fun Smutty Comics
- Guest Comics
- Shareable Comics
- Transcribed
relme: {}
last_post_title: The Joust by Ray Starshine
last_post_description: 'A sexy nsfw comic for your knight time! Lay down your arms,
Expand Down
10 changes: 9 additions & 1 deletion content/discover/feed-010b9595cea7f6655749f9efaf2d8536.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ params:
blogrolls: []
recommended: []
recommender:
- https://danq.blog/comments/feed/
- https://danq.blog/feed/
- https://danq.me/comments/feed/
- https://danq.me/feed/
- https://danq.me/kind/article/feed/
- https://danq.me/kind/note/feed/
categories: []
- https://danq.uk/comments/feed/
- https://danq.uk/feed/
categories:
- Reklamierung
- Über Hörbares
- Über Schaubares
- it girl explosion
relme:
https://github.com/drikkes: true
https://mastodon.social/web/@drikkes: true
Expand Down
7 changes: 6 additions & 1 deletion content/discover/feed-01526b00a3be9113fe350f3742dd6f45.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ params:
blogrolls: []
recommended: []
recommender: []
categories: []
categories:
- Open Web
- WordPress
- IndieWeb
- Meetup
- Stuttgart
relme:
https://developers.google.com/profile/u/pfefferle: false
https://github.com/pfefferle: true
Expand Down
10 changes: 6 additions & 4 deletions content/discover/feed-01de5b50465fa41a1c874fdae284e6c7.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ params:
categories: []
relme:
https://mastodon.social/@timomeh: true
last_post_title: ""
last_post_description: ""
last_post_date: ""
last_post_link: ""
last_post_title: Open Ear Earbuds
last_post_description: In-ear earbuds are weird, aren't they? You've got those small
rubbery mushrooms that you shove into your ear canal to listen to music and you
hope there's no juicy ear gunk on them when you pull 'em
last_post_date: "2024-05-25T22:44:25Z"
last_post_link: https://timomeh.de/posts/open-ear-earbuds
last_post_categories: []
score_criteria:
cats: 0
Expand Down
7 changes: 6 additions & 1 deletion content/discover/feed-0210ba7b42f530ed56e256fd94fc34db.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ params:
recommender:
- https://amerpie.lol/feed.xml
- https://joeross.me/feed.xml
categories: []
categories:
- automation
- drafts
- drafts-actions
- readwise
- shortcuts
relme: {}
last_post_title: Automating Readwise Highlights Import into Drafts
last_post_description: Using Shortcuts and a Drafts Action you can automate the
Expand Down
4 changes: 3 additions & 1 deletion content/discover/feed-0214b639982e7c60ee88017b55c8f65c.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ params:
recommended: []
recommender:
- https://visitmy.website/feed.xml
categories: []
categories:
- 18f
- how we work
relme: {}
last_post_title: '18F practices in action (spoiler: this stuff works)'
last_post_description: Do 18F software development principles really work? We reflected
Expand Down
9 changes: 8 additions & 1 deletion content/discover/feed-0232bb5357ee7eba169a762331c698e8.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ params:
blogrolls: []
recommended: []
recommender: []
categories: []
categories:
- Gedachten
- Geschreven
- Inspiratie
- berk
- birch
- verhaal
- zkv
relme: {}
last_post_title: The Birch
last_post_description: Dit is een kort verhaal dat ik schreef voor Canadese vrienden,
Expand Down
7 changes: 4 additions & 3 deletions content/discover/feed-03f3ef465231ff5693737537f8bb7fb8.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ params:
blogrolls: []
recommended: []
recommender: []
categories: []
categories:
- Society & Culture
relme:
https://micro.blog/adders: false
last_post_title: ""
Expand All @@ -21,14 +22,14 @@ params:
last_post_link: ""
last_post_categories: []
score_criteria:
cats: 0
cats: 1
description: 3
postcats: 0
promoted: 0
promotes: 0
relme: 1
title: 3
website: 2
score: 9
score: 10
ispodcast: true
---
5 changes: 4 additions & 1 deletion content/discover/feed-04e95ecc02d048adbebda2b1a1d201be.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ params:
recommended: []
recommender:
- https://chrisburnell.com/feed.xml
categories: []
categories:
- Introspection
- '#Grief'
- '#philosophising'
relme:
https://mastodon.social/@lars: true
last_post_title: Grief is a boulder
Expand Down
13 changes: 12 additions & 1 deletion content/discover/feed-053022f9b5893c0560dbf50cbffc21fe.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ params:
recommended: []
recommender:
- https://frankmeeuwsen.com/feed.xml
categories: []
categories:
- Article
- Bally MIdway
- games
- gaming
- midway-manufacturing
- Pac-man
- retro gaming
- space-invaders
- stan-jarocki
- Stanley Jarocki
- video games
relme: {}
last_post_title: Bally Midway’s Stanley Jarocki
last_post_description: Sad news to report on the blog this week. Midway’s Director
Expand Down
4 changes: 4 additions & 0 deletions content/discover/feed-0554932e4983f1da8772d55e9df1e807.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ params:
blogrolls: []
recommended: []
recommender:
- https://danq.blog/comments/feed/
- https://danq.blog/feed/
- https://danq.me/comments/feed/
- https://danq.me/feed/
- https://danq.me/kind/article/feed/
- https://danq.me/kind/note/feed/
- https://danq.uk/comments/feed/
- https://danq.uk/feed/
categories: []
relme:
https://twitter.com/Oglaf: false
Expand Down
4 changes: 3 additions & 1 deletion content/discover/feed-05da31e0cf4547c392d505395867d57f.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ params:
recommender:
- http://scripting.com/rss.xml
- http://scripting.com/rssNightly.xml
categories: []
categories:
- Last week
- fediverse
relme: {}
last_post_title: Last Week in Fediverse – ep 71
last_post_description: IFTAS launches a moderator community with IFTAS Connect.
Expand Down
4 changes: 4 additions & 0 deletions content/discover/feed-05e97e1c3ace1f8bd696313d0de2838a.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ params:
blogrolls: []
recommended: []
recommender:
- https://danq.blog/comments/feed/
- https://danq.blog/feed/
- https://danq.me/comments/feed/
- https://danq.me/feed/
- https://danq.me/kind/article/feed/
- https://danq.me/kind/note/feed/
- https://danq.uk/comments/feed/
- https://danq.uk/feed/
categories:
- guest
relme: {}
Expand Down
8 changes: 7 additions & 1 deletion content/discover/feed-06e99f44d8ecab6dc651d3236cb169db.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ params:
- https://www.manton.org/feed
- https://www.manton.org/feed.xml
- https://www.manton.org/podcast.xml
categories: []
categories:
- My Essays
- On Technology
- AI
- Artificial Intelligence
- Generative AI
- Netflix
relme: {}
last_post_title: Is this is the future of “blogging?”
last_post_description: Fable Studio, a San Francisco-based startup that gained fame
Expand Down
5 changes: 4 additions & 1 deletion content/discover/feed-07641ed0b096631a9881356aad9674b2.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ params:
- https://www.manton.org/feed
- https://www.manton.org/feed.xml
- https://www.manton.org/podcast.xml
categories: []
categories:
- AI
- Apple
- Quips
relme: {}
last_post_title: Apple Intelligence
last_post_description: As WWDC draws near, anticipation of Apple’s long-rumored
Expand Down
3 changes: 2 additions & 1 deletion content/discover/feed-089c9db489cfeaf58be3a5376674b2c2.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ params:
- https://jlelse.blog/.min.rss
- https://jlelse.blog/.rss
- https://jlelse.blog/index.xml
categories: []
categories:
- metapost
relme:
https://brainbaking.com/: true
https://github.com/wgroeneveld: true
Expand Down
4 changes: 4 additions & 0 deletions content/discover/feed-08ef60e05c65c925679e0e3341fd0122.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ params:
recommender:
- https://colinwalker.blog/dailyfeed.xml
- https://colinwalker.blog/livefeed.xml
- https://danq.blog/comments/feed/
- https://danq.blog/feed/
- https://danq.me/comments/feed/
- https://danq.me/feed/
- https://danq.me/kind/article/feed/
- https://danq.me/kind/note/feed/
- https://danq.uk/comments/feed/
- https://danq.uk/feed/
categories: []
relme: {}
last_post_title: I'm sorry that nothing is happening here right now
Expand Down
7 changes: 4 additions & 3 deletions content/discover/feed-08fe1656f351314563bf1675493abcae.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ params:
blogrolls: []
recommended: []
recommender: []
categories: []
categories:
- Society & Culture
relme:
https://micro.blog/jakelacaze: false
last_post_title: She’s just a mother—Celebrate the hell out of her
Expand All @@ -22,14 +23,14 @@ params:
last_post_link: https://jakelacaze.com/2024/05/11/shes-just-a.html
last_post_categories: []
score_criteria:
cats: 0
cats: 1
description: 3
postcats: 0
promoted: 0
promotes: 0
relme: 1
title: 3
website: 2
score: 9
score: 10
ispodcast: true
---
16 changes: 15 additions & 1 deletion content/discover/feed-08fe41be3a305a03b111be7071951638.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ params:
recommended: []
recommender:
- https://visitmy.website/feed.xml
categories: []
categories:
- Agile Delivery
- Co-op Experience
- Design
- Digital Product Research
- Principles
- Uncategorized
- user research
- UX
- co-op
- co-op food
- E-com
- e-commerce
- Food
- quick commerce
relme: {}
last_post_title: Using guiding principles to communicate user research findings
on quick commerce
Expand Down
7 changes: 6 additions & 1 deletion content/discover/feed-09477c3b492a63e2766288a26b67e58c.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ params:
blogrolls: []
recommended: []
recommender:
- https://danq.blog/comments/feed/
- https://danq.blog/feed/
- https://danq.me/comments/feed/
- https://danq.me/feed/
- https://danq.me/kind/article/feed/
- https://danq.me/kind/note/feed/
categories: []
- https://danq.uk/comments/feed/
- https://danq.uk/feed/
categories:
- General musings
relme: {}
last_post_title: OED second edition CD-ROM under Wine
last_post_description: I recently discovered that there's an old software edition
Expand Down
3 changes: 2 additions & 1 deletion content/discover/feed-097035c672738e42e8824aeda052be50.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ params:
recommended: []
recommender:
- https://hacdias.com/feed.xml
categories: []
categories:
- Uncategorized
relme:
https://bsky.app/profile/snarfed.org: false
https://fed.brid.gy/r/https:/snarfed.org/: false
Expand Down
Loading

0 comments on commit ee01be3

Please sign in to comment.