subsource

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package subsource implements the SubSource subtitle provider. SubSource has a REST API at api.subsource.net. Requires an API key. Supports both movies and TV episodes via IMDB ID search. Rate limits: 60/min, 1800/hour, 7200/day.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory(_ context.Context, settings map[string]any) (provider.Provider, error)

Factory creates a SubSource provider from settings.

Types

type FlexInt

type FlexInt int

FlexInt unmarshals both string and number JSON representations to an int. SubSource's releaseYear field returns either shape; errors default to zero (unknown year).

func (*FlexInt) UnmarshalJSON

func (f *FlexInt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for FlexInt.

type Provider

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

Provider implements the SubSource API client.

func (*Provider) CheckCredentials added in v0.6.0

func (p *Provider) CheckCredentials(ctx context.Context) error

CheckCredentials reports whether SubSource accepts the configured API key.

The verdict is the STATUS, and the body is never read. Measured 2026-09-19: the key gate runs ahead of routing (an unregistered path answers 401 with `{"error":"Invalid API key"}` just as a real one does), so any answer that is not 401 or 403 means the key was accepted whatever the router then made of the request. A 5xx is the one arm that cannot say either way, so it reports as an incomplete check rather than as a verdict.

func (*Provider) Download

func (p *Provider) Download(ctx context.Context, sub *subflux.Subtitle) ([]byte, error)

Download fetches the subtitle content for the given search result. SubSource returns archives; the subtitle file is extracted automatically.

func (*Provider) Name

func (p *Provider) Name() subflux.ProviderID

Name returns the provider identifier for SubSource.

func (*Provider) Search

func (p *Provider) Search(ctx context.Context, req *subflux.SearchRequest) ([]subflux.Subtitle, error)

Search finds subtitles matching the request via IMDB ID lookup. Tries alternative titles if the primary title is not found.

Jump to

Keyboard shortcuts

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