chapters

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(g *echo.Group, db *bun.DB, authMiddleware *auth.Middleware)

func ShouldUpdateChapters

func ShouldUpdateChapters(newChapters []mediafile.ParsedChapter, newSource string, existingSource *string, forceRefresh bool) bool

ShouldUpdateChapters determines if chapters should be updated based on priority rules. Returns true if the new chapters should replace existing ones.

Types

type ChapterInput

type ChapterInput struct {
	Title            string         `json:"title"`
	StartPage        *int           `json:"start_page"`
	StartTimestampMs *int64         `json:"start_timestamp_ms"`
	Href             *string        `json:"href"`
	Children         []ChapterInput `json:"children"`
}

ChapterInput represents a chapter in API requests.

type ReplaceChaptersPayload

type ReplaceChaptersPayload struct {
	Chapters []ChapterInput `json:"chapters"`
}

ReplaceChaptersPayload is the request body for replacing chapters.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(db *bun.DB) *Service

func (*Service) DeleteChaptersForFile

func (svc *Service) DeleteChaptersForFile(ctx context.Context, fileID int) error

DeleteChaptersForFile deletes all chapters for a file.

func (*Service) ListChapters

func (svc *Service) ListChapters(ctx context.Context, fileID int) ([]*models.Chapter, error)

ListChapters retrieves all chapters for a file, building nested structure.

func (*Service) ReplaceChapters

func (svc *Service) ReplaceChapters(ctx context.Context, fileID int, chapters []mediafile.ParsedChapter) error

ReplaceChapters deletes all existing chapters for a file and inserts new ones.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL