Skip to content

Group README entries by type into TV Series / Documentaries / Movies#28

Merged
andygrunwald merged 2 commits intomainfrom
andygrunwald/group-readme-by-type
May 5, 2026
Merged

Group README entries by type into TV Series / Documentaries / Movies#28
andygrunwald merged 2 commits intomainfrom
andygrunwald/group-readme-by-type

Conversation

@andygrunwald
Copy link
Copy Markdown
Contributor

Summary

The single `## Movies` heading becomes three: TV Series, Documentaries, Movies. Empty groups are hidden, so today's all-Documentary catalogue renders with one section; future typed entries pick up their bucket automatically.

Why

The `type` field on every entry was unused for layout. Grouping by it gives the README a clearer skeleton without any schema churn — and bakes in the right shape for upcoming biopics or docuseries.

What changed

  • `app/cmd/convertJsonToReadme.go`: new `groupedMovies` struct + `groupMoviesByType` helper. The handler buckets entries once by `Type` and passes the struct to the template instead of a flat slice.
  • `assets/README.template`: TOC and body restructured into three guarded sections; the per-entry rendering block is lifted into a named `{{ define "entry" }}` partial so the three section bodies stay short.
  • Empty / unknown `Type` falls into Documentaries silently — `validateCategoryAndType` already warns at YAML→JSON time, so there's no second warning needed at render time.

Sample TOC (current catalogue)

```

Table of Contents

Mixed-type smoke test

Flipped one entry's `type` to `Movie` in its generated JSON, re-rendered: a `## Movies (1)` section appears below `## Documentaries (31)` in both TOC and body, the entry no longer shows up under Documentaries. Reverted before commit.

Test plan

  • `cd app && go build ./... && go vet ./... && go test ./...` — all passing, including new `TestGroupMoviesByType`.
  • `go run . convertJsonToReadme …` — TOC and headings render correctly.
  • Per-entry block (description, duration, language, type, category, tags, ratings, watch link) is byte-equivalent to the old layout — only the surrounding section structure changed.

Commit-by-commit

  1. Group entries by type and render three sections — code, template, test.
  2. `chore: Update generated movie content` — regenerated README.

🤖 Generated with Claude Code

The single ## Movies heading collapses the catalogue into a
homogeneous list. Now that every entry carries a type, group them
into three sections and skip the empty ones — today only
Documentaries renders, but TV Series and Movies sections will
appear automatically the moment a typed entry lands.

The grouping happens once in convertJsonToReadme via a small
groupMoviesByType helper that buckets each entry by its Type.
Entries with an empty or out-of-set Type fall into Documentaries
as a sensible default; validateCategoryAndType has already warned
the maintainer at YAML→JSON time, so nothing here is silent.

The per-entry rendering block (description / duration / language
/ type / category / tags / IMDb rating / YouTube likes / Watch on)
is lifted into a named template "entry" so the three section
bodies stay short and cannot drift apart over time.

Visual change today: ## Movies becomes ## Documentaries; entries
underneath unchanged.
Regenerate README.md with the new grouped layout. Single
## Documentaries section today; the TV Series and Movies sections
appear automatically when typed entries land in the catalogue.
@andygrunwald andygrunwald merged commit 44ee3d9 into main May 5, 2026
5 checks passed
@andygrunwald andygrunwald deleted the andygrunwald/group-readme-by-type branch May 5, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant