adapters

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Overview

Package adapters bridges runtime plugin contributions (WS9a list sources and WS9c Live TV channel sources) into Ether's collection, personalization and Live TV registries.

Package adapters bridges installed Ether plugins (internal/plugins) into the core media, catalogue, live TV, subtitle, marker, notification and ranking interfaces (SPEC §5.1.3, WS9).

Index

Constants

View Source
const MaxPluginListItems = stremio.MaxCatalogItems

MaxPluginListItems bounds one list source refresh.

Variables

This section is empty.

Functions

func AttachDebrid

func AttachDebrid(mgr *plugins.Manager, svc *debrid.Service)

AttachDebrid registers native plugin providers without copying their sealed credentials into server configuration. Disable/remove immediately unregisters.

func AttachMetadata

func AttachMetadata(mgr *plugins.Manager, registry metadataRegistry)

AttachMetadata makes both native and adapted providers use the catalogue's shared registration, identity checks, persistence and materialization policy.

func AttachSubtitles

func AttachSubtitles(mgr *plugins.Manager, svc *subtitles.Service)

func ExpandAddonIndexers

func ExpandAddonIndexers(ctx context.Context, mgr *plugins.Manager, rows []config.Indexer) []config.Indexer

ExpandAddonIndexers is the indexer list the running search manager searches: the owner's rows, then one row per installed plugin that serves streams (an Ether source plugin, or a Stremio add-on installed from Plugins with its streams on). Plugin rows are never saved: the plugin is their configuration, and the Indexers page stays the owner's own list.

func IsLocalPayload

func IsLocalPayload(b []byte) bool

IsLocalPayload reports whether b is an encoded LocalPayload.

Types

type Bridge

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

Bridge tracks the source kinds registered for each plugin so enable, disable, update and uninstall cleanly replace or remove them.

func Attach

func Attach(mgr *plugins.Manager, cols *collections.Service, pers *personalize.Engine, tv *livetv.Service) *Bridge

Attach wires plugin list sources (collections + Home rows) and Live TV channel sources to the plugin manager's lifecycle.

func (*Bridge) Sync

func (b *Bridge) Sync(_ context.Context, r plugins.Record)

Sync updates all adapter registrations for one plugin record.

type Engine

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

Engine wraps an inner core.Engine (and core.ReleaseHealthChecker) so ETHER-LOCAL/1 payloads open granted local files directly via os.Open and satisfy core.LocalFileSource.

func (*Engine) Check

func (e *Engine) Check(ctx context.Context, payload []byte) (bool, error)

Check implements core.HealthChecker.

func (*Engine) CheckRelease

func (e *Engine) CheckRelease(ctx context.Context, releaseID string, payload []byte) (bool, error)

CheckRelease implements core.ReleaseHealthChecker.

func (*Engine) Open

func (e *Engine) Open(ctx context.Context, releaseID string, payload []byte) (core.MediaSource, error)

Open implements core.Engine.

func (*Engine) Prefetch

func (e *Engine) Prefetch(ctx context.Context, releaseID string, payload []byte, offset, length int64) error

Prefetch implements core.Engine.

type LocalPayload

type LocalPayload struct {
	PluginID  string `json:"pluginId"`
	ReleaseID string `json:"releaseId"`
	FilePath  string `json:"filePath"`
	Name      string `json:"name"`
	Size      int64  `json:"size"`
	Origin    string `json:"origin,omitempty"`
	Remote    bool   `json:"remote,omitempty"`
}

LocalPayload describes a local file stream authorized through a plugin's folders: read grant (SPEC §5.1.4). Permission and symlink containment are re-verified on every CheckRelease and Open call so revoking a folder grant takes effect immediately.

func DecodeLocalPayload

func DecodeLocalPayload(b []byte) (LocalPayload, error)

DecodeLocalPayload parses an encoded LocalPayload.

func (LocalPayload) Encode

func (p LocalPayload) Encode() []byte

Encode serializes p with the local payload prefix.

type MarkerBridge

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

func AttachMarkers

func AttachMarkers(ctx context.Context, mgr *plugins.Manager, svc *markers.Service, catalog core.Catalog, selected func(string) bool) *MarkerBridge

func (*MarkerBridge) Schedule

func (b *MarkerBridge) Schedule(key core.RatingKey, d time.Duration) <-chan struct{}

Schedule queues work without contacting a plugin on the caller's path.

func (*MarkerBridge) Wait

func (b *MarkerBridge) Wait()

Wait waits for the background worker to stop after its context is cancelled.

type Ranking

type Ranking struct {
	Manager  RankingManager
	Registry *extend.Registry
}

func (Ranking) NewResolve

func (a Ranking) NewResolve(ctx context.Context, caps core.ClientCaps) resolver.RankingSession

type RankingManager

type RankingManager interface {
	HotReady(string) (plugins.HotRuntime, bool)
	RecordRanking(context.Context, string, plugins.RankingReport)
}

Ranking bridges the resolver to installed hosted hot-path plugins.

type SourceStats

type SourceStats struct {
	PluginID string `json:"pluginId"`
	Name     string `json:"name"`
	Class    string `json:"class"`
	Searches int64  `json:"searches"`
	Grabs    int64  `json:"grabs"`
	Failures int64  `json:"failures"`
}

SourceStats reports per-plugin stream-source activity for the Sources -> Usage tab.

type StreamSources

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

StreamSources adapts enabled `stream_source` plugins into a core.Indexer (and core.StreamingIndexer / core.RescueIndexer) alongside an optional inner indexer (typically *newznab.Manager).

func NewStreamSources

func NewStreamSources(inner core.Indexer) *StreamSources

NewStreamSources constructs a StreamSources adapter wrapping inner.

func (*StreamSources) Backend

func (s *StreamSources) Backend(ix config.Indexer) (newznab.Backend, error)

Backend returns the search backend of an add-on indexer row (newznab.Options.Backend). Backends are kept per row so throttling state survives between searches.

func (*StreamSources) Bind

func (s *StreamSources) Bind(mgr *plugins.Manager, deb *debrid.Service)

Bind attaches the plugin manager and debrid service once they are built.

func (*StreamSources) FetchNZB

func (s *StreamSources) FetchNZB(ctx context.Context, r core.Release) ([]byte, error)

FetchNZB implements core.Indexer. An Ether plugin's lazy and local-file streams are opened here at play time (their GUID names the plugin and the stream); everything else is the inner indexer's.

func (*StreamSources) HasEnabledPlugins

func (s *StreamSources) HasEnabledPlugins(ctx context.Context) bool

HasEnabledPlugins reports whether at least one stream_source plugin is enabled.

func (*StreamSources) HasTorrentIndexer

func (s *StreamSources) HasTorrentIndexer() bool

HasTorrentIndexer implements the debrid sourceInventory contract.

func (*StreamSources) MissingSources

func (s *StreamSources) MissingSources() error

MissingSources implements the debrid/resolver sourceInventory contract.

func (*StreamSources) Name

func (s *StreamSources) Name() string

Name implements core.Indexer.

func (*StreamSources) Order

func (s *StreamSources) Order() []string

Order returns the current preferred plugin source order.

func (*StreamSources) ResolveTorrent

func (s *StreamSources) ResolveTorrent(ctx context.Context, r core.Release) (core.Release, error)

ResolveTorrent implements debrid.TorrentResolver.

func (*StreamSources) Search

func (s *StreamSources) Search(ctx context.Context, req core.SearchRequest) ([]core.Release, error)

Search implements core.Indexer.

func (*StreamSources) SearchRescue

func (s *StreamSources) SearchRescue(ctx context.Context, req core.SearchRequest) ([]core.Release, error)

SearchRescue implements core.RescueIndexer.

func (*StreamSources) SearchRescueWith

func (s *StreamSources) SearchRescueWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)

SearchRescueWith implements core.StreamingRescueIndexer.

func (*StreamSources) SearchWith

func (s *StreamSources) SearchWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)

SearchWith implements core.StreamingIndexer. Add-on streams are searched as indexer rows inside inner (see Backend).

func (*StreamSources) SetAnimeIDs

func (s *StreamSources) SetAnimeIDs(a stremio.AnimeIDs)

SetAnimeIDs wires the anime id mapping used for add-ons that look anime up by Kitsu, MAL, AniList or AniDB ids.

func (*StreamSources) SetClock

func (s *StreamSources) SetClock(now func() time.Time)

SetClock overrides the clock used for rate-limit windows in tests.

func (*StreamSources) SetNZBClient

func (s *StreamSources) SetNZBClient(c *http.Client)

SetNZBClient overrides the client that downloads add-on NZBs (tests).

func (*StreamSources) SetOrder

func (s *StreamSources) SetOrder(ids []string)

SetOrder sets the preferred plugin source order (plugin IDs).

func (*StreamSources) SetUsenetReady

func (s *StreamSources) SetUsenetReady(fn func() bool)

SetUsenetReady wires the Usenet readiness check so non-plugin Usenet releases still require an enabled Usenet provider when plugin sources are active.

func (*StreamSources) Stats

func (s *StreamSources) Stats(ctx context.Context) []SourceStats

Stats returns per-plugin search and grab counters for enabled stream_source plugins.

func (*StreamSources) WrapEngine

func (s *StreamSources) WrapEngine(inner core.Engine) *Engine

WrapEngine wraps inner with local-file payload support backed by s.

type SubtitleProbe

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

SubtitleProbe exercises the ordinary subtitle broker with one installed provider. Offers and explicit picks are isolated from viewer selections and production sidecars. Each session is single-use, bounded and cleaned up.

func NewSubtitleProbe

func NewSubtitleProbe(mgr *plugins.Manager, catalog probeCatalog) *SubtitleProbe

func (*SubtitleProbe) Close

func (p *SubtitleProbe) Close()

func (*SubtitleProbe) Handler

func (p *SubtitleProbe) Handler() http.Handler

Jump to

Keyboard shortcuts

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