source

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anime

type Anime struct {
	Name         string
	URL          string
	Cover        string
	Year         int
	Genres       []string
	Status       string
	MALID        int    // MyAnimeList ID for metadata linkage
	AniListID    int    // AniList ID for metadata linkage
	AllAnimeID   string // AllAnime show ID for episode/streams
	EpisodeCount int    // Total episode count
	Type         string // "TV", "Movie", "OVA", etc.
	Rating       string // "PG-13 - Teens 13 or older"
	Score        float64
	Rank         int
	Popularity   int
	Source       Source
}

Anime represents a single anime title with its metadata from providers like Jikan/AniList. It serves as the central data model passed between search, episode listing, and stream resolution.

func (*Anime) String

func (a *Anime) String() string

String returns the anime name for display in lists and TUI selection.

type Episode

type Episode struct {
	Number float64
	Title  string
	URL    string
	Season int // 0 = no season (single season anime)
	Anime  *Anime
}

Episode represents a single episode within an anime season. It links back to its parent Anime for context during stream resolution.

func (*Episode) String

func (e *Episode) String() string

String returns a display-friendly episode identifier: the title if available, otherwise the episode number (integer or decimal for half-episodes).

type Season

type Season struct {
	Number int
	Name   string // e.g., "Season 1", "Season 2 - Cour 1"
}

Season represents a single season of an anime, used to organize episodes when an anime has multiple cours or parts (e.g., "Season 2 - Cour 1").

type Source

type Source interface {
	// Name returns the human-readable provider name (e.g., "Jikan", "AllAnime").
	Name() string
	// Search queries the provider for anime matching the given string.
	Search(query string) ([]*Anime, error)
	// SeasonsOf returns available seasons for an anime, enabling multi-season navigation.
	SeasonsOf(anime *Anime) ([]Season, error)
	// EpisodesOf returns episodes for a specific season of an anime.
	EpisodesOf(anime *Anime, season int) ([]*Episode, error)
	// StreamsOf resolves playable stream URLs for a given episode.
	StreamsOf(episode *Episode) ([]*Stream, error)
	// ID returns the unique provider identifier used in config and registration.
	ID() string
}

Source is the core abstraction for all anime data providers (Jikan, AllAnime, AniList). It defines the contract for searching anime, listing seasons/episodes, and resolving streams. This interface decouples the TUI/CLI from specific provider implementations.

type Stream

type Stream struct {
	Quality       string
	URL           string
	Provider      string
	Referer       string // Required for some providers
	Subtitles     []Subtitle
	NeedsReferrer bool // True if stream requires Referer header to play
}

Stream represents a single playable video source for an episode. Each stream has a quality level, direct URL, and the provider it came from. The Referer field is required by some CDN providers to authorize playback.

type Subtitle

type Subtitle struct {
	Language string
	URL      string
}

Subtitle represents a subtitle track associated with a stream.

Jump to

Keyboard shortcuts

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