Documentation
¶
Overview ¶
Package animemap maps TMDB titles to the anime databases (Kitsu, MyAnimeList, AniList, AniDB) whose ids anime-only Stremio addons look titles up by.
The mapping is the community anime-lists dataset (Fribb/anime-lists on GitHub), read at runtime only when an addon needs it. Ether ships no copy. The dataset is untrusted input: the download is size- and time-bounded, failures back off, and any ambiguity yields no mapping rather than a guess, so callers keep their IMDb lookups and simply skip the addon.
Index ¶
Constants ¶
const ( Kitsu = "kitsu" MAL = "mal" AniList = "anilist" AniDB = "anidb" )
Databases an anime addon may look titles up by (Stremio id prefixes).
const DefaultURL = "https://raw.githubusercontent.com/Fribb/anime-lists/master/anime-list-mini.json"
DefaultURL is the dataset Ether reads by default.
Variables ¶
ErrUnavailable reports that the dataset could not be loaded (or is backing off after a failure). Callers treat it as "no mapping".
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
URL string // "" = DefaultURL
Client *http.Client // nil = a public-only safefetch client
Logger *slog.Logger
Now func() time.Time
TTL time.Duration // 0 = 24h
MaxBytes int64 // 0 = 32 MiB
Timeout time.Duration // 0 = 90s
}
Options configure a Service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service loads the dataset lazily and answers lookups from memory.
func (*Service) Lookup ¶
func (s *Service) Lookup(ctx context.Context, req core.SearchRequest, db string) (id int64, episode int, ok bool, err error)
Lookup maps a search request to db's id and, for an episode, the episode's number inside that entry. ok is false when the request has no unambiguous mapping. err is non-nil only when the dataset is unavailable.