PlayerStream
EN
Ko-fi

Guides / Create an addon

Addon · catalog

Catalog addon.

Your own rows of movies and series in PlayerStream. Your addon says which titles there are; the app adds each one's page, poster and details.

Only content you have permission for. Whoever creates an addon is responsible for what it offers, and whoever adds it to the app, for what they add. Only use content you have the right to use. The examples in this guide are open movies from the Blender Foundation (CC BY 3.0).

01

What it's for.

A catalog addon provides a list of titles: for example, “My video store's movies”, “Public domain silent films” or “My school's short films”. In PlayerStream it shows up as one more row in Movies, Series or, if it mixes both, in Home.

It only says which titles there are and in what order. To watch them, something also has to provide their links: the same addon (see Link addon) or another one.

AndroidAndroid TVWindowsWeb version
02

What you need.

  • Somewhere to put a few JSON files, or a small program that replies in JSON. For testing, your own PC.
  • To publish it: an https address and, for the web version of the app, CORS enabled (see Publishing your addon).
  • The TMDB (or IMDb) id of each title. That's how the app knows which movie or series it is.
03

How the request travels.

The app always requests from the same base address: your manifest's, without manifest.json. First the manifest; then whatever the manifest says it offers. The video never goes through your addon: the app requests it directly from wherever it is.

The app requests the manifest, the catalog and the links from the addon, and the video from the server where it is The app Your addon Video host GET /manifest.json id, name, catalogs… GET /catalog/…json metas: the titles GET /stream/…json streams: where it is GET the video (in chunks)
Catalog and links can come from the same addon or from two different ones.
04

The manifest.

It's the addon's business card: https://your-site/manifest.json. Here is a minimal one that works:

manifest.json
{
  "id": "org.example.open-movies",
  "version": "1.0.0",
  "name": "Open Movies (example)",
  "resources": ["catalog"],
  "types": ["movie"],
  "catalogs": [
    { "type": "movie", "id": "open-movies", "name": "Open movies",
      "extra": [{ "name": "skip" }] }
  ]
}

What the app reads:

FieldWhat for
idRequired. Unique and stable (for example, your domain reversed). Don't change it: it's how the app recognizes the addon.
nameRequired. The name shown in Settings and on each link.
versionBump it when you change something: the app checks the manifest on startup and every 15 minutes, and that's how it knows there's something new.
catalogsYour catalogs: type, id, name and extra. The rows come from here (not from resources).
types, idPrefixesThe types and id prefixes of your resources (they matter for links and subtitles: see their guides).
behaviorHints.configurationRequiredWith true, the app doesn't add it and asks for it to be configured first at /configure.

Not used (although other apps use them): description, logo, background, contactEmail, behaviorHints.configurable and adult, addonCatalogs, nor the old extraSupported / extraRequired format.

Configuration, in the address

If your addon needs per-user data, put it in the path, before manifest.json: https://your-site/abc123/manifest.json. The app repeats it in every request. Nothing after manifest.json (a ?query breaks).

06

A working example.

A complete addon in Python 3.9 or later, with nothing to install: catalog, links and subtitles for three open movies. Save it as addon.py and start it with python addon.py.

addon.py
# addon.py — an example addon for PlayerStream (Python 3.9 or later, nothing to install)
# Open movies from the Blender Foundation (CC BY 3.0). Start it and add this in the app:
#   http://YOUR-PC-IP:8840/manifest.json
import json
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import unquote, urlsplit

MANIFIESTO = {
    "id": "org.example.open-movies",
    "version": "1.0.0",
    "name": "Open Movies (example)",
    "resources": ["catalog", "stream", "subtitles"],
    "types": ["movie"],
    "idPrefixes": ["tmdb:", "tt"],
    "catalogs": [{"type": "movie", "id": "open-movies", "name": "Open movies",
                  "extra": [{"name": "skip"}]}],
}
# TMDB id: (IMDb id, name, year, video)
PELICULAS = {
    "45745": ("tt1727587", "Sintel", "2010",
              "https://download.blender.org/durian/movies/Sintel.2010.1080p.mkv"),
    "10378": ("tt1254207", "Big Buck Bunny", "2008",
              "https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"),
    "133701": ("tt2285752", "Tears of Steel", "2012",
               "https://download.blender.org/demo/movies/ToS/tears_of_steel_720p.mov"),
}
SUBTITULOS_TOS = "https://download.blender.org/demo/movies/ToS/subtitles/"


def buscar(ident):
    """'tmdb:45745' o 'tt1727587' → '45745' (o None)."""
    for tmdb, (imdb, *_resto) in PELICULAS.items():
        if ident in (f"tmdb:{tmdb}", imdb):
            return tmdb
    return None


def responder(ruta):
    partes = ruta.strip("/").removesuffix(".json").split("/")
    if ruta == "/manifest.json":
        return MANIFIESTO
    if partes[:3] == ["catalog", "movie", "open-movies"]:
        if len(partes) > 3:                      # …/skip=3.json: there are no more pages
            return {"metas": []}
        return {"metas": [{"id": f"tmdb:{t}", "type": "movie", "name": n, "releaseInfo": a}
                          for t, (_imdb, n, a, _video) in PELICULAS.items()]}
    if partes[:2] == ["stream", "movie"] and len(partes) == 3:
        t = buscar(partes[2])
        if not t:
            return {"streams": []}
        _imdb, nombre, anio, video = PELICULAS[t]
        return {"streams": [{"name": "Open Movies",
                             "title": f"{nombre} ({anio}) · Blender Foundation · CC BY 3.0",
                             "url": video}]}
    if partes[:2] == ["subtitles", "movie"] and len(partes) >= 3:
        if buscar(partes[2]) != "133701":        # only Tears of Steel has official subtitles
            return {"subtitles": []}
        return {"subtitles": [
            {"id": "tos-eng", "lang": "eng", "url": SUBTITULOS_TOS + "TOS-en.srt"},
            {"id": "tos-spa", "lang": "spa", "url": SUBTITULOS_TOS + "TOS-es.srt"}]}
    return None


class Addon(BaseHTTPRequestHandler):
    def do_GET(self):
        datos = responder(unquote(urlsplit(self.path).path))
        cuerpo = json.dumps(datos if datos is not None else {"error": "no existe"}).encode()
        self.send_response(200 if datos is not None else 404)
        self.send_header("Content-Type", "application/json; charset=utf-8")
        self.send_header("Access-Control-Allow-Origin", "*")
        self.send_header("Content-Length", str(len(cuerpo)))
        self.end_headers()
        self.wfile.write(cuerpo)


print("Addon en http://0.0.0.0:8840/manifest.json (Ctrl+C para pararlo)")
ThreadingHTTPServer(("0.0.0.0", 8840), Addon).serve_forever()

No program? Loose files on any hosting also work: see an addon with files only.

07

Adding it in the app.

  1. Open Settings → Content → Addons. In the “Add” box, type the address in “Address, JSON or line”. With or without manifest.json at the end: the app completes it.
  2. Tap “Add”. The app checks it and says what it offers: “From Stremio: links for movies, 1 catalog, subtitles”.
  3. Tap the addon's gear → “Create its catalog” (or “Create all its catalogs”). Or in Settings → Content → Catalogs → Available, in the addon’s group: Movies, Series or Home.
  4. Go to Movies (or Series): your row is already there, with its pages and posters.
Settings, Addons: the example addon's address typed in the “Address, JSON or line” field and the “Add” button
1. The address, in Settings → Content → Addons (“Address, JSON or line”). On the test PC, the emulator sees your PC as 10.0.2.2.
The example addon added, with the line “From Stremio: links for movies, 1 catalog, subtitles”
2. Added: what it offers, in green.
The addon's gear menu open, with “Create its catalog”, “Update”, “Reset broken links”, “Ignore filters” and “Ignore order”
3. The addon's gear: “Create its catalog” and “Update” to read it again.
Settings, Catalogs, Order tab: the Home section’s catalogs in a row, with their arrows to move them, the eye to hide them and their gear icon
In Settings → Content → Catalogs → Order you can reorder, hide or remove it, like any other row. More in Catalogs and collections.
Movies in PlayerStream with the example addon's row: Sintel, Big Buck Bunny and Tears of Steel with their posters
4. The row, in Movies. The posters and details come from the app (here, without a TMDB key: from TheTVDB.com).
08

Common errors.

The app saysWhat's wrong
“Not responding (…): is it on and is that its address?”It can't be reached, or it replies with an error (for example, 404) or something that isn't JSON. Open the address in the browser on the same device.
“That address isn't an addon (it has no manifest.json).”It replies, but without id or name.
“… needs to be configured before use…”The manifest has configurationRequired: add the address your configuration page gives you.
“That addon is already added.”There's already one with that address.
The row doesn't show up“Create its catalog” is missing; or the ids are neither tmdb: nor tt; or the catalog has a required extra the app doesn't send.
Titles are missingWith tt…, the ones the app can't find don't show up. Use tmdb:.

Checking it

  • Open …/manifest.json and …/catalog/movie/open-movies.json in the browser: they must show as JSON.
  • From the TV or phone, use your PC's IP (not 127.0.0.1, which is the device itself) and make sure the firewall lets it in.
  • Timeouts: 8 seconds to connect and 20 to reply (30 for the manifest).