Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ BindAddr: "localhost", Port: 8080, LogLevel: "info", RedirectURL: "", DisableRequestLogging: false, Profiling: false, }
DefaultOptions is an Options object with default values.
var ( // NotFound signals that the catalog/meta/stream was not found. // It leads to a "404 Not Found" response. NotFound = errors.New("Not found") )
Functions ¶
This section is empty.
Types ¶
type Addon ¶
type Addon struct {
// contains filtered or unexported fields
}
Addon represents a remote addon. You can create one with NewAddon() and then run it with Run().
func NewAddon ¶
func NewAddon(manifest Manifest, catalogHandlers map[string]CatalogHandler, streamHandlers map[string]StreamHandler, opts Options) (Addon, error)
NewAddon creates a new Addon object that can be started with Run(). A proper manifest must be supplied, but all but one handler can be nil in case you only want to handle specific requests and opts can be the zero value of Options.
type BehaviorHints ¶
type BehaviorHints struct { // Note: Must include `omitempty`, otherwise it will be included if this struct is used in another one, even if the field of the containing struct is marked as `omitempty` Adult bool `json:"adult,omitempty"` }
type CatalogHandler ¶
type CatalogHandler func(id string) ([]MetaPreviewItem, error)
CatalogHandler is the callback for catalog requests for a specific type (like "movie"). The id parameter is the catalog ID that you specified yourself in the CatalogItem objects in the Manifest.
type CatalogItem ¶
type CatalogItem struct { Type string `json:"type"` ID string `json:"id"` Name string `json:"name"` // Optional Extra []ExtraItem `json:"extra,omitempty"` }
CatalogItem represents an item in the catalog
type Manifest ¶
type Manifest struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` // One of the following is required // Note: Can only have one in code because of how Go (de-)serialization works //Resources []string `json:"resources,omitempty"` ResourceItems []ResourceItem `json:"resources,omitempty"` Types []string `json:"types"` Catalogs []CatalogItem `json:"catalogs"` // Optional IDprefixes []string `json:"idPrefixes,omitempty"` Background string `json:"background,omitempty"` // URL Logo string `json:"logo,omitempty"` // URL ContactEmail string `json:"contactEmail,omitempty"` BehaviorHints BehaviorHints `json:"behaviorHints,omitempty"` }
Manifest describes the capabilities of the addon. See https://github.com/Stremio/stremio-addon-sdk/blob/ddaa3b80def8a44e553349734dd02ec9c3fea52c/docs/api/responses/manifest.md
type MetaItem ¶
type MetaItem struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` // Optional Poster string `json:"poster,omitempty"` // URL PosterShape string `json:"posterShape,omitempty"` Background string `json:"background,omitempty"` // URL Logo string `json:"logo,omitempty"` // URL Description string `json:"description,omitempty"` IMDBrating string `json:"imdbRating,omitempty"` Released string `json:"released,omitempty"` // Must be ISO 8601, e.g. "2010-12-06T05:00:00.000Z" Links []MetaLinkItem `json:"links,omitempty"` Videos []VideoItem `json:"videos,omitempty"` Runtime string `json:"runtime,omitempty"` Language string `json:"language,omitempty"` Country string `json:"country,omitempty"` Awards string `json:"awards,omitempty"` Website string `json:"website,omitempty"` // URL }
This represents a meta item and is meant to be used when info for a specific item was requested. It *can* be used for catalog responses (as long as a Poster URL is given), but is meant for requests for specific items. Catalog responses contain MetaPreviewItem objects. See https://github.com/Stremio/stremio-addon-sdk/blob/ddaa3b80def8a44e553349734dd02ec9c3fea52c/docs/api/responses/meta.md
type MetaLinkItem ¶
type MetaLinkItem struct { Name string `json:"name"` Category string `json:"category"` URL string `json:"url"` // // URL. Can be "Meta Links" (see https://github.com/Stremio/stremio-addon-sdk/blob/ddaa3b80def8a44e553349734dd02ec9c3fea52c/docs/api/responses/meta.links.md) }
type MetaPreviewItem ¶
type MetaPreviewItem struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` Poster string `json:"poster"` // URL // Optional PosterShape string `json:"posterShape,omitempty"` Background string `json:"background,omitempty"` // URL Logo string `json:"logo,omitempty"` // URL Description string `json:"description,omitempty"` }
This represents a meta item and is meant to be used within catalog responses. See https://github.com/Stremio/stremio-addon-sdk/blob/ddaa3b80def8a44e553349734dd02ec9c3fea52c/docs/api/responses/meta.md
Note: According to a Stremio developer the catalog response can include all fields from the MetaItem as well though!
type Options ¶
type Options struct { // The interface to bind to. // "0.0.0.0" to bind to all interfaces. "localhost" to *exclude* requests from other machines. // Default "localhost". BindAddr string // The port to listen on. // Default 8080. Port int // The log level. // Only logs with the same or a higher log level will be shown. // For example when you set it to "info", info, warn, error, fatal and panic logs will be shown, but no debug or trace logs. // Must be parseable by logrus: https://pkg.go.dev/github.com/sirupsen/logrus?tab=doc#ParseLevel // Default "info". LogLevel string // URL to redirect to when someone requests the root of the handler instead of the manifest, catalog, stream etc. // When no value is set, it will lead to a "404 Not Found" response. // Default "". RedirectURL string // Flag for indicating whether requests should be logged. // Default false (meaning requests will be logged by default). DisableRequestLogging bool // Flag for indicating whether you want to expose URL handlers for the Go profiler. // The URLs are be the standard ones: "/debug/pprof/...". // Default false. Profiling bool }
Options are the options that can be used to configure the addon.
type ResourceItem ¶
type StreamHandler ¶
type StreamHandler func(id string) ([]StreamItem, error)
StreamHandler is the callback for stream requests for a specific type (like "movie"). The id parameter can be for example an IMDb ID if your addon handles the "movie" type.
type StreamItem ¶
type StreamItem struct { // One of the following is required URL string `json:"url,omitempty"` // URL YoutubeID string `json:"ytId,omitempty"` InfoHash string `json:"infoHash,omitempty"` ExternalURL string `json:"externalUrl,omitempty"` // URL // Optional Title string `json:"title,omitempty"` FileIndex uint8 `json:"fileIdx,omitempty"` // Only when using InfoHash }
StreamItem represents a stream for a MetaItem. See https://github.com/Stremio/stremio-addon-sdk/blob/ddaa3b80def8a44e553349734dd02ec9c3fea52c/docs/api/responses/stream.md
type VideoItem ¶
type VideoItem struct { ID string `json:"id"` Title string `json:"title"` Released string `json:"released"` // Must be ISO 8601, e.g. "2010-12-06T05:00:00.000Z" // Optional Thumbnail string `json:"thumbnail,omitempty"` // URL Streams []StreamItem `json:"streams,omitempty"` Available bool `json:"available,omitempty"` Episode string `json:"episode,omitempty"` Season string `json:"season,omitempty"` Trailer string `json:"trailer,omitempty"` // Youtube ID Overview string `json:"overview,omitempty"` }