From 981911077ba1fab3be488a7912235dfd61470880 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 24 Apr 2026 14:02:43 -0400 Subject: [PATCH] feat(templates): expand reader and progress template types for format-aware display Add fields to ReaderMetadata and ReadingProgress template types to support KOReader-like progress display: ReaderMetadata: - TotalCharacters: from media item, used for estimated page calculation - EstimatedPages: computed via sync.EstimatedPages() ReadingProgress: - Chapter: current chapter index from reading_progress - ChapterProgress: within-chapter progress (0-100, multiplied from DB fraction) - FormatGroup: item format for conditional display logic These fields enable format-aware progress display (pages for comics/PDFs, estimated pages for reflowable, percentage for all). --- templates/types.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/templates/types.go b/templates/types.go index cedfb9d..8ec1371 100644 --- a/templates/types.go +++ b/templates/types.go @@ -161,17 +161,22 @@ type ReaderMetadata struct { ReadingDirection string `json:"reading_direction"` FileURL string `json:"file_url"` LibraryID string `json:"library_id"` + TotalCharacters int64 `json:"total_characters"` + EstimatedPages int `json:"estimated_pages"` } type ReadingProgress struct { - ID string - MediaItemID string - UserID string - CurrentPage int - TotalPages int - Percentage float64 - EpubCfi string - LastReadAt time.Time + ID string + MediaItemID string + UserID string + CurrentPage int + TotalPages int + Percentage float64 + EpubCfi string + LastReadAt time.Time + Chapter int + ChapterProgress float64 + FormatGroup string } type Bookmark struct {