skyhook

package
v0.10.0-dev.37 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package skyhook reads SkyHook, Sonarr's metadata service, for a series' episode list in one of its orders, the lists Sonarr builds its own from. A request reaches only https://skyhook.sonarr.tv, on a public address.

Index

Constants

View Source
const MaxBody = 16 << 20

MaxBody bounds one answer; a larger one is refused, never cut.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client reads SkyHook; it is safe for concurrent use.

func New

func New(base *http.Client, log *slog.Logger) *Client

New copies base, nil meaning a zero client, onto ssrf's transport, which dials only public addresses on port 443, with an exact-origin redirect policy; a nil log is slog.Default.

func (*Client) Show

func (c *Client) Show(ctx context.Context, tvdbID int, lang, order string) (Show, bool, error)

Show reads GET /v2/tvdb/shows/{lang}/{tvdbID}/{order}, the request Sonarr 5 makes, in at most 3 attempts inside ctx's deadline. tvdbID is 1 to 2^31-1, lang three ASCII lowercase letters and order 1 to 32 bytes of [a-z0-9]; any other is an error with nothing sent. A 404 answers (Show{}, false, nil). A 408, 429, 5xx or transport failure, after the last attempt, is an httpclient.IsTransient error, and no other failure is. An error's text is one line naming the series and order, never the answer's body.

type Episode

type Episode struct {
	AirDate, Title           string // "" when SkyHook sends null
	ID                       uint64 // the TVDB episode id
	Season, Number, Absolute int    // Absolute 0 when SkyHook sends none
}

Episode is one episode where the requested order places it. ID passes media.ValidExternalID and each number media.ValidEpisodeNumber.

type Order

type Order struct{ Type, Name string }

Order is one of the series' episode orders.

type Show

type Show struct {
	Orders   []Order // the answer's seasonTypes
	Episodes []Episode
}

Show is the decoded subset of one answer.

Jump to

Keyboard shortcuts

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