Diet enrichment
I recently moved my media tracking posts from weekly to monthly, mostly because weekly tracking had become one of those tiny chores that was somehow both too small to care about and too annoying to actually do.
The new monthly script is cleaner. It still pulls the raw data from the places where the data already lives:
but it now aggregates them at a monthly level, instead of being an item-by-item list of what happened on what date.
That gets me most of the way there, but the generated draft still required me to copy and paste the initial output into the media enricher tool I created - which is just more toil.
So I wired the two together. The media diet script still does the same basic job as before: fetch everything, format it into Markdown sections, and write a draft post. The new bit happens after formatting: each section gets passed through an API call to the enricher, which takes the plain bullet points and returns enriched Markdown.
In practice, that means this sort of thing:
- Finished Blindsight by Peter Watts.turns into:
- Finished [Blindsight](https://hardcover.app/books/blindsight) by Peter Watts.Same post, fewer tabs, less ⌘-C, ⌘-V.
I kept the enricher outside the main blog repo for a couple of reasons. First, it keeps the generator focused - the blog script should know how to ask Hardcover what I read, Last.fm what I listened to, Trakt what I watched, and Komga what comics I read. It shouldn’t also become a pile of fuzzy matching logic for every media database on the internet.
Second, enrichment is inherently a little messy - if a lookup fails or returns something weird, I want that problem isolated from the part that creates the post. The generator now treats enrichment as a best-effort pass: if the API works, great; if it fails, the post still gets written with the original Markdown.
That fallback behaviour means the enricher is useful, but not load-bearing. A flaky lookup service shouldn’t stop me from generating a draft post.
The npm run new:media-diet command now goes like this:
- Fetch the previous month’s media data.
- Format each source into Markdown.
- Send the bullet lines to the enricher.
- Preserve headings and prose.
- Swap in enriched bullets when available.
- Write the draft.
A small change, but it makes the output feel much closer to publishable. The May media diet post was the first proper run with the new setup, and the first time the generated draft felt less like raw export data and more like an actual blog post. Which is the whole point of this kind of automation, really - not to remove every bit of editing, but to speed up the boring parts so I can hit publish before being distracted by something shiny.