### Install and Run Addon SDK Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Commands to install the necessary npm package and run the example addon. After running, it outputs a URL for installing the addon in Stremio. ```bash npm install stremio-addon-sdk node ./addon.js ``` -------------------------------- ### serveHTTP(addonInterface, options) Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Starts the addon server. It can also react to process arguments for launching and installing the addon. ```APIDOC ## serveHTTP(addonInterface, options) ### Description Starts the addon server. This method also handles launching Stremio in the browser and installing the addon via command-line arguments. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `options` object: * `port` (number) - The port number for the server. * `cacheMaxAge` (number) - Cache maximum age in seconds. Sets the `Cache-Control` header to `max-age=$cacheMaxAge`. * `static` (string) - Path to a directory of static files to be served (e.g., `/public`). ### Process Arguments: * `--launch`: Launches Stremio in the web browser and automatically installs/upgrades the addon. * `--install`: Installs the addon in the desktop version of Stremio. ``` -------------------------------- ### Install Now CLI Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/now.md Install the Now.sh command-line interface globally using npm. This tool is used to deploy your project to Now.sh. ```bash npm install -g now ``` -------------------------------- ### Example Stremio Addon Manifest Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/responses/manifest.md This manifest example is for an addon that provides streams and catalogs, includes a movie catalog, and will receive stream requests for meta items with IDs starting with 'tt'. ```javascript { "id": "org.stremio.example", "version": "0.0.1", "description": "Example Stremio Addon", "name": "Example Addon", "resources": [ "catalog", "stream" ], "types": [ "movie", "series" ], "catalogs": [ { "type": "movie", "id": "moviecatalog" } ], "idPrefixes": ["tt"] } ``` -------------------------------- ### serveHTTP(addonInterface, options) Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Starts an HTTP server to serve the addon, making it accessible to Stremio. ```APIDOC serveHTTP(builder.getInterface(), { port: 7000 }) ``` -------------------------------- ### Install Beamup CLI Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/beamup.md Install the Beamup command-line interface globally using npm. This command is required before you can use beamup. ```bash npm install beamup-cli -g ``` -------------------------------- ### Deploy Project with Beamup Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/beamup.md Navigate to your project directory and use the `beamup` command to deploy. This command handles both initial setup and subsequent deployments. ```bash beamup ``` -------------------------------- ### Stremio Addon Builder Initialization Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/now.md Initialize the addon builder with your manifest. This code is typically part of your addon's setup. ```javascript const { addonBuilder } = require("stremio-addon-sdk") const addon = new addonBuilder(manifest); ``` -------------------------------- ### Define Catalog Handler Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/requests/defineCatalogHandler.md This example demonstrates how to define a catalog handler for 'movie' type and 'top' ID. It includes logic to respond to both general catalog feed requests and specific search requests within the catalog. If the search query matches 'big buck bunny', it returns the 'Big Buck Bunny' meta object; otherwise, it returns an empty array. For non-matching catalog types or IDs, it returns an empty catalog. ```javascript builder.defineCatalogHandler(function(args) { if (args.type === 'movie' && args.id === 'top') { // we will only respond with Big Buck Bunny // to both feed and search requests const meta = { id: 'tt1254207', name: 'Big Buck Bunny', releaseInfo: '2008', poster: 'https://image.tmdb.org/t/p/w600_and_h900_bestv2/uVEFQvFMMsg4e6yb03xOfVsDz4o.jpg', posterShape: 'poster', banner: 'https://image.tmdb.org/t/p/original/aHLST0g8sOE1ixCxRDgM35SKwwp.jpg', type: 'movie' } if (args.extra && args.extra.search) { // catalog search request if (args.extra.search == 'big buck bunny') { return Promise.resolve({ metas: [meta] }) } else { return Promise.resolve({ metas: [] }) } } else { // catalog feed request return Promise.resolve({ metas: [meta] }) } } else { // otherwise return empty catalog return Promise.resolve({ metas: [] }) } }) ``` -------------------------------- ### Create and Serve a Stremio Addon Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md This example demonstrates how to create a basic Stremio addon that provides a stream for a specific movie. It defines a stream handler and serves the addon over HTTP on port 7000. To publish, uncomment and configure the publishToCentral call. ```javascript #!/usr/bin/env node const { addonBuilder, serveHTTP, publishToCentral } = require('stremio-addon-sdk') const builder = new addonBuilder({ id: 'org.myexampleaddon', version: '1.0.0', name: 'simple example', // Properties that determine when Stremio picks this addon // this means your addon will be used for streams of the type movie resources: ['stream'], types: ['movie'], idPrefixes: ['tt'] }) // takes function(args), returns Promise builder.defineStreamHandler(function(args) { if (args.type === 'movie' && args.id === 'tt1254207') { // serve one stream to big buck bunny // return addonSDK.Stream({ url: '...' }) const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' } return Promise.resolve({ streams: [stream] }) } else { // otherwise return no streams return Promise.resolve({ streams: [] }) } }) serveHTTP(builder.getInterface(), { port: 7000 }) // If you want this addon to appear in the addon catalogs, call .publishToCentral() with the publically available URL to your manifest //publishToCentral('https://my-addon.com/manifest.json') ``` -------------------------------- ### Serve Manifest with User Parameters using Express Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md This Express.js example demonstrates how to create a dynamic manifest.json endpoint that accepts a user-specific parameter from the URL. This allows addons to be personalized based on user input, such as authentication tokens. ```javascript const express = require('express') const addon = express() addon.get('/:someParameter/manifest.json', function (req, res) { res.send({ id: 'org.parameterized.'+req.params.someParameter, name: 'addon for '+req.params.someParameter, resources: ['stream'], types: ['series'], }) }) addon.get('/:someParameter/stream/:type/:id.json', function(req, res) { // @TODO do something depending on req.params.someParameter res.send({ streams: [] }) }) addon.listen(7000, function() { console.log('http://127.0.0.1:7000/[someParameter]/manifest.json') }) ``` -------------------------------- ### Get Addon Interface Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Converts the configured addon into an immutable `addonInterface` object. This interface contains the manifest and a `get` function for fetching resources. ```javascript builder.getInterface() ``` -------------------------------- ### Video Object - Series Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/responses/meta.md Represents a detailed video object for a series episode. Use this when providing full metadata for a specific episode. ```javascript { id: "tt0108778:1:1", title: "Pilot", released: new Date("1994-09-22 20:00 UTC+02"), season: 1, episode: 1, overview: "Monica and the gang introduce Rachel to the real world after she leaves her fiancé at the altar." } ``` -------------------------------- ### defineResourceHandler Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/requests/defineResourceHandler.md Handles requests for addon catalogs, returning a list of addons that can be installed. It supports cache control headers for optimizing responses. ```APIDOC ## defineResourceHandler This method currently handles addon catalog requests. As opposed to `defineCatalogHandler()` which handles meta catalogs, this method handles catalogs of addon manifests. This means that an addon can be used to just pass a list of other addons that can be installed in Stremio. ### Arguments: `args` - request object; parameters described below ### Returns: A promise that resolves to an object containing `{ addons: [] }` with an array of [Catalog Addon Object](../responses/addon_catalog.md) The resolving object can also include the following cache related properties: - `{ cacheMaxAge: int }` (in seconds) which sets the `Cache-Control` header to `max-age=$cacheMaxAge` and overwrites the global cache time set in `serveHTTP` [options](../../README.md#servehttpaddoninterface-options) - `{ staleRevalidate: int }` (in seconds) which sets the `Cache-Control` header to `stale-while-revalidate=$staleRevalidate` - `{ staleError: int }` (in seconds) which sets the `Cache-Control` header to `stale-if-error=$staleError` ## Request Parameters ``type`` - type of the catalog's content; e.g. `movie`, `series`, `channel`, `tv` (see [Content Types](../responses/content.types.md)) ``id`` - string id of the catalog that is requested; these are set in the [Manifest Object](../responses/manifest.md) ``config`` - object with user settings, see [Manifest - User Data](../responses/manifest.md#user-data) ## Basic Example ```javascript builder.defineResourceHandler('addon_catalog', function(args) { return Promise.resolve({ addons: [ { transportName: 'http', transportUrl: 'https://example.addon.org/manifest.json', manifest: { id: 'org.myexampleaddon', version: '1.0.0', name: 'simple example', catalogs: [], resources: ['stream'], types: ['movie'], idPrefixes: ['tt'] } } ] }) }) ``` [Catalog Addon Object Definition](../responses/addon_catalog.md) ``` -------------------------------- ### Configure Beamup CLI Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/beamup.md Run the beamup config command after installation or whenever GitHub keys are modified. This command is essential for setting up your deployment environment. ```bash beamup config ``` -------------------------------- ### Import Stremio Addon SDK Components Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Imports essential components from the Stremio Addon SDK. Use `addonBuilder` to define addons, `serveHTTP` to start a server, `getRouter` to convert an addon interface to an Express router, and `publishToCentral` to publish the addon. ```javascript const { addonBuilder, serveHTTP, getRouter, publishToCentral } = require('stremio-addon-sdk') ``` -------------------------------- ### publishToCentral(manifestUrl) Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Publishes the addon to the Stremio central addon catalog, making it available for installation by users. ```APIDOC publishToCentral('https://my-addon.com/manifest.json') ``` -------------------------------- ### Define Subtitles Handler Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/requests/defineSubtitlesHandler.md This example demonstrates how to define a subtitles handler. It checks the item ID and returns a specific subtitle URL for 'tt1254207' or an empty array for other IDs. ```javascript builder.defineSubtitlesHandler(function(args) { if (args.id === 'tt1254207') { // serve one subtitle for big buck bunny const subtitle = { url: 'https://mkvtoolnix.download/samples/vsshort-en.srt', lang: 'eng' } return Promise.resolve({ subtitles: [subtitle] }) } else { // otherwise return no subtitles return Promise.resolve({ subtitles: [] }) } }) ``` -------------------------------- ### Custom Meta Request Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/protocol.md Handles meta requests when not using IMDB IDs. This requires defining a 'meta' resource in the manifest and providing custom IDs. ```json { "meta": [ { "id": "exampleid1", "type": "movie", "name": "Big Buck Bunny", "poster": "https://image.tmdb.org/t/p/w600_and_h900_bestv2/uVEFQvFMMsg4e6yb03xOfVsDz4o.jpg" } ] } ``` -------------------------------- ### Get Express Router from Addon Interface Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Converts an `addonInterface` into an Express router. This router serves the addon according to the Stremio protocol and provides a landing page at the root URL. ```javascript getRouter(addonInterface) ``` -------------------------------- ### Define Stream Handler Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/requests/defineStreamHandler.md Handles movie stream requests by returning a specific stream for 'big buck bunny' or an empty array for other requests. Ensure to import the builder object before using this method. ```javascript builder.defineStreamHandler(function(args) { if (args.type === 'movie' && args.id === 'tt1254207') { // serve one stream for big buck bunny const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' } return Promise.resolve({ streams: [stream] }) } else { // otherwise return no streams return Promise.resolve({ streams: [] }) } }) ``` -------------------------------- ### Video Object - YouTube Video Example Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/responses/meta.md Represents a video object for a YouTube video, often used for channels. Includes ID, title, release date, and thumbnail. ```javascript { id: "yt_id:UCrDkAvwZum-UTjHmzDI2iIw:9bZkp7q19f0", title: "PSY - GANGNAM STYLE", released: new Date("2012-07-15 20:00 UTC+02"), thumbnail: "https://i.ytimg.com/vi/9bZkp7q19f0/hqdefault.jpg" } ``` -------------------------------- ### Catalog Response for Movies Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/protocol.md Provides a list of movies for a specific catalog. This example includes 'Big Buck Bunny' with its IMDB ID and poster URL. ```json { "metas": [ { "id": "tt1254207", "type": "movie", "name": "Big Buck Bunny", "poster": "https://image.tmdb.org/t/p/w600_and_h900_bestv2/uVEFQvFMMsg4e6yb03xOfVsDz4o.jpg" } ] } ``` -------------------------------- ### Define Catalog Handler Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Handles requests for addon catalogs, including search functionality. Refer to the API documentation for catalog request parameters and examples. ```javascript builder.defineCatalogHandler(function handler(args) { }) ``` -------------------------------- ### Define Resource Handler for Addon Catalog Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Handles addon catalog requests, allowing an addon to list other addon manifests. Refer to the API documentation for request parameters and examples. ```javascript builder.defineResourceHandler('addon_catalog', function handler(args) { }) ``` -------------------------------- ### Define Meta Handler Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Handles metadata requests for items like titles, release information, posters, and backgrounds. Refer to the API documentation for meta request parameters and examples. ```javascript builder.defineMetaHandler(function handler(args) { }) ``` -------------------------------- ### Define Subtitles Handler Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Handles subtitle requests. Refer to the API documentation for subtitle request parameters and examples. ```javascript builder.defineSubtitlesHandler(function handler(args) { }) ``` -------------------------------- ### Define a Basic Catalog in Manifest Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Declare a catalog resource in your addon's manifest. This is the minimum required to create a standard catalog. ```json { "resources": ["catalog"], "catalogs": [ { "id": "testcatalog", "type": "movie" } ] } ``` -------------------------------- ### Now.json Configuration for Serverless Deployment Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/now.md Configure your Now.sh deployment using `now.json`. This file specifies the build process and routing for your serverless function. ```json { "version": 2, "builds": [ { "src": "serverless.js", "use": "@now/node" } ], "routes": [ { "src": "/.*", "dest": "/serverless.js" } ] } ``` -------------------------------- ### Initialize Addon Builder Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Creates an addon builder instance with a manifest object. The manifest defines the addon's basic information and how it's invoked by Stremio. Invalid manifests will cause this to throw an error. ```javascript const builder = new addonBuilder(manifest) ``` -------------------------------- ### Stremio Addon Serverless Handler Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/now.md Create a serverless handler file that uses the Stremio addon SDK's router to manage incoming requests. This file acts as the entry point for Now.sh. ```javascript const { getRouter } = require("stremio-addon-sdk") const addonInterface = require("./addon") const router = getRouter(addonInterface) module.exports = function(req, res) { router(req, res, function() { res.statusCode = 404; res.end(); }); } ``` -------------------------------- ### Link to Stremio Addon Manifest Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deep-links.md Convert a normal URL to a Stremio addon manifest by replacing 'https://' with 'stremio://'. ```url stremio://watchhub-us.strem.io/manifest.json ``` -------------------------------- ### Clone and Run NuvioMobile Project Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/README.md Clone the repository and run the mobile application for Android or iOS using the provided script. ```bash git clone https://github.com/NuvioMedia/NuvioMobile.git cd NuvioMobile ./scripts/run-mobile.sh android # or ./scripts/run-mobile.sh ios ``` -------------------------------- ### Stremio Addon Resource Structure Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/README.md Illustrates the hierarchical structure of addon resources within Stremio, from catalog to subtitles. ```text +-- Catalog +-- Meta Item +-- Videos (part of Meta Item) +--+-- Streams +--+--+-- Subtitles ``` -------------------------------- ### Configure Catalog Pagination with Skip Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Define catalog configuration to enable pagination using the 'skip' extra field. This allows Stremio to request items in chunks. ```json catalogs: [ { "id": "testcatalog", "type": "movie", "extra": [ { "name": "skip", "isRequired": false } ] } ] ``` ```json catalogs: [ { "id": "testcatalog", "type": "movie", "extra": [ { "name": "skip", "options": ["0", "100", "200"], "isRequired": false } ] } ] ``` -------------------------------- ### defineStreamHandler Method Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/requests/defineStreamHandler.md This method is called by Stremio to get streams for a specific item. It should return a promise that resolves to an object containing an array of stream objects, ordered by quality. ```APIDOC ## defineStreamHandler This method handles stream requests. ### Arguments: `args` - request object; parameters described below ### Returns: A promise resolving to an an object containing `{ streams: [] }` with an array of [Stream Objects](../responses/stream.md). The streams should be ordered from highest to lowest quality The resolving object can also include the following cache related properties: - `{ cacheMaxAge: int }` (in seconds) which sets the `Cache-Control` header to `max-age=$cacheMaxAge` and overwrites the global cache time set in `serveHTTP` [options](../../README.md#servehttpaddoninterface-options) - `{ staleRevalidate: int }` (in seconds) which sets the `Cache-Control` header to `stale-while-revalidate=$staleRevalidate` - `{ staleError: int }` (in seconds) which sets the `Cache-Control` header to `stale-if-error=$staleError` ## Request Parameters ``type`` - type of the item that we're requesting streams for; e.g. `movie`, `series`, `channel`, `tv` (see [Content Types](../responses/content.types.md)) ``id`` - a Video ID as described in the [Video Object](../responses/meta.md#video-object) **The Video ID is the same as the Meta ID for movies**. For IMDb series (provided by Cinemeta), the video ID is formed by joining the Meta ID, season and episode with a colon (e.g. `"tt0898266:9:17"`). ``config`` - object with user settings, see [Manifest - User Data](../responses/manifest.md#user-data) ## Basic Example ```javascript builder.defineStreamHandler(function(args) { if (args.type === 'movie' && args.id === 'tt1254207') { // serve one stream for big buck bunny const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' } return Promise.resolve({ streams: [stream] }) } else { // otherwise return no streams return Promise.resolve({ streams: [] }) } }) ``` [Stream Object Definition](../responses/stream.md) _Note: You may require additional metadata for the requested item (such as name, releaseInfo, etc), if the requested ID is a IMDB ID (Cinemeta, for example, uses only IMDB IDs), then please refer to [Getting Metadata from Cinemeta](https://github.com/Stremio/stremio-addon-sdk/blob/master/docs/advanced.md#getting-metadata-from-cinemeta) for this purpose._ ``` -------------------------------- ### Implement Catalog Handler with Pagination Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Implement a catalog handler that uses the 'skip' argument to slice and return a portion of the meta list. This is crucial for paginated catalogs. ```javascript // we only have one meta item const meta = { id: 'tt1254207', name: 'Big Buck Bunny', releaseInfo: '2008', poster: 'https://image.tmdb.org/t/p/w600_and_h900_bestv2/uVEFQvFMMsg4e6yb03xOfVsDz4o.jpg', posterShape: 'poster', banner: 'https://image.tmdb.org/t/p/original/aHLST0w8sOE1ixCxRDgM35SKwwp.jpg', type: 'movie' } const metaList = [] // but we'll make an array that includes our meta 60 times for (let i = 0; i++; i < 60) { metaList.push(meta) } builder.defineCatalogHandler(function(args) { return new Promise(function(resolve, reject) { if (args.id == 'testcatalog') { // we'll slice our meta list using // skip as the starting point const skip = args.extra.skip || 0 resolve({ metas: metaList.slice(skip, skip + 20) }) } else { reject(new Error('Unknown catalog request')) } }) }) ``` -------------------------------- ### Fetch Metadata from Cinemeta API Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Use the 'needle' library to make an HTTP GET request to the Cinemeta API to retrieve metadata for a given movie or series ID and type. ```javascript var needle = require('needle') // we will get metadata for the movie: Big Buck Bunny var itemType = 'movie' var itemImdbId = 'tt1254207' needle.get('https://v3-cinemeta.strem.io/meta/' + itemType + '/' + itemImdbId + '.json', function(err, resp, body) { if (body && body.meta) { // log Big Buck Bunny's metadata console.log(body.meta) } }) ``` -------------------------------- ### Define Addon Catalog Handler Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/api/requests/defineResourceHandler.md Use this method to handle requests for addon catalogs. It should return a promise that resolves to an object containing an array of addon definitions. ```javascript builder.defineResourceHandler('addon_catalog', function(args) { return Promise.resolve({ addons: [ { transportName: 'http', transportUrl: 'https://example.addon.org/manifest.json', manifest: { id: 'org.myexampleaddon', version: '1.0.0', name: 'simple example', catalogs: [], resources: ['stream'], types: ['movie'], idPrefixes: ['tt'] } } ] }) }) ``` -------------------------------- ### addonInterface Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md The addon interface object, obtained from `builder.getInterface()`, provides methods for interacting with addon resources and accessing the manifest. ```APIDOC ## addonInterface ### Description The `addonInterface` object is used to fetch data from the addon and access its manifest. ### Properties * `get({ resource, type, id, extra })` - Returns a Promise that resolves with the requested data. * `resource` (string) - The resource to fetch. * `type` (string) - The type of the resource. * `id` (string) - The ID of the resource. * `extra` (object) - Additional parameters for the request. * `manifest` - An object containing the addon's manifest information. ``` -------------------------------- ### Build NuvioMobile Project Artifacts Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/README.md Commands to build debug artifacts and compile for specific iOS architectures. ```bash ./gradlew :composeApp:assembleDebug ``` ```bash ./gradlew :composeApp:compileKotlinIosSimulatorArm64 ``` ```bash ./scripts/build-distribution.sh ``` -------------------------------- ### Handle Search and Standard Catalog Requests Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Implement a catalog handler that differentiates between standard catalog requests and search requests, responding with metadata accordingly. ```javascript const meta = { id: 'tt1254207', name: 'Big Buck Bunny', releaseInfo: '2008', poster: 'https://image.tmdb.org/t/p/w600_and_h900_bestv2/uVEFQvFMMsg4e6yb03xOfVsDz4o.jpg', posterShape: 'poster', banner: 'https://image.tmdb.org/t/p/original/aHLST0g8sOE1ixCxRDgM35SKwwp.jpg', type: 'movie' } builder.defineCatalogHandler(function(args) { return new Promise(function(resolve, reject) { if (args.id == 'testcatalog') { // this is a request to our catalog id if (args.extra.search) { // this is a search request if (args.extra.search == 'big buck bunny') { // if someone searched for "big buck bunny" (exact match) // respond with our meta item resolve({ metas: [meta] }) } else { reject(new Error('No search results found')) } } else { // this is a standard catalog request // just respond with our meta item resolve({ metas: [meta] }) } } else { reject(new Error('Unknown catalog request')) } }) }) ``` -------------------------------- ### Enable Search in a Catalog Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Configure a catalog to support searching by adding a 'search' extra parameter. Set 'isRequired' to true to make the catalog search-only. ```json catalogs: [ { "id": "testcatalog", "type": "movie", "extra": [ { "name": "search", "isRequired": false } ] } ] ``` ```json catalogs: [ { "id": "testcatalog", "type": "movie", "extra": [ { "name": "search", "isRequired": true } ] } ] ``` -------------------------------- ### Enable Genre Filtering in a Catalog Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md Configure a catalog to support filtering by genre by adding a 'genre' extra parameter with available options. ```json catalogs: [ { "id": "testcatalog", "type": "movie", "extra": [ { "name": "genre", "options": [ "Drama", "Action" ], "isRequired": false } ] } ] ``` -------------------------------- ### Addon Manifest Configuration Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/protocol.md Defines the addon's metadata, resources, and types. Use 'tt' as an idPrefix for streams to leverage Stremio's built-in Cinemeta addon for metadata. ```json { "id": "org.myexampleaddon", "version": "1.0.0", "name": "simple Big Buck Bunny example", "types": [ "movie" ], "catalogs": [ { "type": "movie", "id": "bbbcatalog" } ], "resources": [ "catalog", { "name": "stream", "types": [ "movie" ], "idPrefixes": [ "tt" ] } ] } ``` -------------------------------- ### Deep Link to Stremio Library Page Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deep-links.md Navigate to the Stremio library page using a deep link. ```url stremio:///library ``` -------------------------------- ### Handle Deep Links with Stream Resource Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/advanced.md This JavaScript snippet shows how to define a stream handler that responds with a deep link. When a user clicks on the stream, Stremio will navigate to the specified deep link, in this case, the 'board' page. ```javascript // this responds with one stream for the Big Buck Bunny // movie, that if clicked, will redirect Stremio to the // Board page builder.defineStreamHandler(function(args) { return new Promise(function(resolve, reject) { if (args.type === 'movie' && args.id === 'tt1254207') { // serve one stream for big buck bunny const stream = { externalUrl: 'stremio:///board' } resolve({ streams: [stream] }) } else { reject(new Error('No streams found for: ' + args.id)) } }) }) ``` -------------------------------- ### Deep Link to Stremio Board Page Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deep-links.md Navigate to the Stremio board page using a deep link. ```url stremio:///board ``` -------------------------------- ### Stremio Addon Serverless Export Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deploying/now.md Modify your addon's main file to export the interface instead of serving HTTP directly. This is required for serverless deployments. ```javascript module.exports = addon.getInterface() ``` -------------------------------- ### Publish Addon to Central Catalog Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/README.md Publishes the addon to the central Stremio addon catalog by providing a public URL to its `manifest.json` file. This makes the addon available in Stremio's Community Addons list. ```javascript publishToCentral(url) ``` -------------------------------- ### Deep Link to Stremio Discover Page Source: https://github.com/nuviomedia/nuviomobile/blob/cmp-rewrite/Docs/Stremio addons refer/deep-links.md Navigate to the Stremio discover page. This link can optionally filter by catalog addon URL, content type, ID, and genre. ```url stremio:///discover ``` ```url stremio:///discover/{catalogAddonUrl}/{type}/{id}?genre={genre} ```