coveragehandlers

package
v0.5.49 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package coveragehandlers provides HTTP handlers for the /api/coverage/* endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoverageRadarrClient added in v0.1.106

type CoverageRadarrClient interface {
	Movies(ctx context.Context) ([]arrapi.Movie, error)
	MovieByTmdbID(ctx context.Context, tmdbID int) (arrapi.Movie, bool, error)
	ResolveExcludeTagIDs(ctx context.Context, tags []string, logMissing bool) map[int]struct{}
	ResolveExcludeTagIDsErr(ctx context.Context, tags []string, logMissing bool) (map[int]struct{}, error)
}

CoverageRadarrClient is the Radarr surface coverage handlers use; the four methods mirror CoverageSonarrClient's.

type CoverageSonarrClient added in v0.1.106

type CoverageSonarrClient interface {
	Series(ctx context.Context) ([]arrapi.Series, error)
	SeriesByTvdbID(ctx context.Context, tvdbID int) (arrapi.Series, bool, error)
	ResolveExcludeTagIDs(ctx context.Context, tags []string, logMissing bool) map[int]struct{}
	ResolveExcludeTagIDsErr(ctx context.Context, tags []string, logMissing bool) (map[int]struct{}, error)
}

CoverageSonarrClient is the Sonarr surface coverage handlers use: the series list, the per-item tvdb→row index lookup the series summary answers from, the shipped fail-open exclude-tag resolution (plain reads), and the error-returning form a ?recovery=1 read needs — its wave failure or refusal must reach the wire typed, never as a silent empty-exclusion 200.

type CoverageStore

type CoverageStore interface {
	SubtitleFiles(ctx context.Context, mediaType subflux.MediaType, mediaIDPrefix string) ([]subflux.SubtitleEntry, error)
	ScanStates(ctx context.Context, mediaType subflux.MediaType, mediaIDPrefix string) ([]subflux.ScanStateRow, error)
}

CoverageStore is the two reads the coverage endpoints answer from: the subtitle-file inventory and the scan-state rows. 2 of the 36 methods the store offers, and 2 of the 12 in the coverage family — these handlers report coverage, they never record it.

type Deps

type Deps struct {
	Store     CoverageStore
	StateFunc func() *LiveState
}

Deps holds the dependencies for coverage handlers.

type Handler

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

Handler provides HTTP handlers for the /api/coverage/* endpoints.

func NewHandler

func NewHandler(deps Deps) *Handler

NewHandler creates a coverage Handler with the given dependencies.

func (*Handler) HandleCoverageDetail

func (h *Handler) HandleCoverageDetail(w http.ResponseWriter, r *http.Request)

HandleCoverageDetail returns per-episode subtitle files for a series. GET /api/coverage/series/{tvdbId}

func (*Handler) HandleCoverageMovieSubs added in v0.5.0

func (h *Handler) HandleCoverageMovieSubs(w http.ResponseWriter, r *http.Request)

HandleCoverageMovieSubs returns one movie's subtitle rows. A STORE-ONLY read (A2): rows or an empty list, whatever the arrs would say about the id — an excluded or vanished movie still answers its rows — so it performs no arr read, has nothing to wave, and does not interpret ?recovery=1. 400 only on a malformed id. GET /api/coverage/movies/{tmdbId}/subs

func (*Handler) HandleCoverageMovieSummary added in v0.5.0

func (h *Handler) HandleCoverageMovieSummary(w http.ResponseWriter, r *http.Request)

HandleCoverageMovieSummary returns the coverage summary for ONE movie, keyed by its TMDB id, with no subtitle rows (/subs owns those). Exclusion parity (A2): 404 exactly where the collection omits. Honors ?recovery=1. GET /api/coverage/movies/{tmdbId}/summary

func (*Handler) HandleCoverageMovies

func (h *Handler) HandleCoverageMovies(w http.ResponseWriter, r *http.Request)

HandleCoverageMovies returns subtitle coverage for all movies. Honors ?recovery=1 by marking the request context for the arr-read wrapper. GET /api/coverage/movies

func (*Handler) HandleCoverageSeries

func (h *Handler) HandleCoverageSeries(w http.ResponseWriter, r *http.Request)

HandleCoverageSeries returns subtitle coverage for all TV series. Honors ?recovery=1 by marking the request context for the arr-read wrapper. GET /api/coverage/series

func (*Handler) HandleCoverageSeriesSummary added in v0.5.0

func (h *Handler) HandleCoverageSeriesSummary(w http.ResponseWriter, r *http.Request)

HandleCoverageSeriesSummary returns the coverage summary for ONE series, keyed by its TVDB id: the same row the collection serializes, resolved through the arr wrapper's tvdb→row index and one prefix-bounded subtitle_files scan. Exclusion parity (A2): 404 exactly where the collection omits. Honors ?recovery=1 by marking the request context for the arr-read wrapper. GET /api/coverage/series/{tvdbId}/summary

func (*Handler) HandleScanStates

func (h *Handler) HandleScanStates(w http.ResponseWriter, r *http.Request)

HandleScanStates returns scan timestamps for all scanned media items. GET /api/coverage/scan-state?type=episode&prefix=tvdb-81189-

type LiveState

type LiveState struct {
	Cfg    coverageCfg
	Sonarr CoverageSonarrClient // nil when sonarr not configured
	Radarr CoverageRadarrClient // nil when radarr not configured
}

LiveState holds the runtime state needed by coverage handlers.

type MovieItem added in v0.1.29

type MovieItem struct {
	Title          string                    `json:"title"`
	ImdbID         string                    `json:"imdb_id,omitempty"`
	SceneName      string                    `json:"scene_name,omitempty"`
	InCinemas      string                    `json:"in_cinemas,omitempty"`
	DigitalRelease string                    `json:"digital_release,omitempty"`
	AudioLang      string                    `json:"audio_lang"`
	Rule           string                    `json:"rule"`
	Targets        []coverage.TargetCoverage `json:"targets"`
	Tags           []int                     `json:"tags,omitempty"`
	TmdbID         int                       `json:"tmdb_id"`
	ID             int                       `json:"id"`
	Year           int                       `json:"year"`
	HasFile        bool                      `json:"has_file"`
	Excluded       bool                      `json:"excluded,omitempty"`
}

MovieItem is the coverage summary for one movie. It carries no file path (S7): clients address the video by MediaRef (id = arr ID) and the server resolves paths. Subtitle rows travel on /subs (A2/A3), never inline.

type SeriesItem added in v0.1.29

type SeriesItem struct {
	Title      string                    `json:"title"`
	ImdbID     string                    `json:"imdb_id,omitempty"`
	FirstAired string                    `json:"first_aired,omitempty"`
	AudioLang  string                    `json:"audio_lang"`
	Rule       string                    `json:"rule"`
	Targets    []coverage.TargetCoverage `json:"targets"`
	Tags       []int                     `json:"tags,omitempty"`
	ID         int                       `json:"id"`
	Year       int                       `json:"year"`
	TvdbID     int                       `json:"tvdb_id"`
	Episodes   int                       `json:"episodes"`
	Excluded   bool                      `json:"excluded,omitempty"`
}

SeriesItem is the coverage summary for one TV series.

Jump to

Keyboard shortcuts

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