Closed zoreu closed 1 month ago
I'm trying to create a stremio addon with flask but I get an error when trying to add it to stremio
my code:
from flask import Flask, request, jsonify import platform import json app = Flask(__name__) sistema_operacional = platform.system() @app.route('/') def index(): return "Pagina incial" @app.route('/manifest.json') def manifest(): manifest = { "id": "addon_bigbuck", "version": "1.0.0", "name": "Addon Big Buck Bunny", "description": "Um addon simples para Stremio sobre o filme Big Buck Bunny.", "resources": ['catalog', 'stream', 'meta'], # Adicionado 'meta' aqui "types": ['movie'], "idPrefixes": ["bb"], "catalogs": [ { "type": "movie", "id": "addon_bigbuck_filme", "name": "Big Buck Bunny", "extra": [ {"name": "trailer", "isRequired": True}, {"name": "imdbRating", "isRequired": False}, {"name": "year", "isRequired": False} ], "options": { "Estados Unidos": "bb123" } } ] } return jsonify(manifest) def respond_with(data): resp = jsonify(data) resp.headers['Access-Control-Allow-Origin'] = '*' # Allow requests from any origin (adjust if needed) resp.headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS' # Allow common HTTP methods resp.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization' # Allow relevant headers return resp @app.route('/catalog/movie/<id>.json') def catalog_movie(id): if id == "bb123": # Suponhamos que "bb123" é o ID do filme Big Buck Bunny catalog = { "id": "bb123", "type": "movie", "name": "Big Buck Bunny", "poster": "https://example.com/bigbuckbunny_poster.jpg", "background": "https://example.com/bigbuckbunny_background.jpg", "description": "Big Buck Bunny é um curta-metragem de animação...", "trailer": "https://example.com/bigbuckbunny_trailer.mp4", "imdbRating": "7.5", "year": "2008" } #return jsonify([catalog]) respond_with([catalog]) else: return respond_with([]) @app.route('/stream/movie/<id>.json') def stream_movie(id): if id == "bb123": # Suponhamos que "bb123" é o ID do filme Big Buck Bunny streams = [ { "title": "Big Buck Bunny", "url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", "isFree": True } ] return respond_with(streams) else: return respond_with([]) @app.route('/meta/movie/<id>.json') def meta_movie(id): if id == "bb123": # Suponhamos que "bb123" é o ID do filme Big Buck Bunny meta = { "id": "bb123", "type": "movie", "name": "Big Buck Bunny", "description": "Big Buck Bunny é um curta-metragem de animação...", "poster": "https://example.com/bigbuckbunny_poster.jpg", "background": "https://example.com/bigbuckbunny_background.jpg", "releaseInfo": { "year": "2008" }, "runtime": 560, "cast": ["Personagem 1", "Personagem 2", "Personagem 3"], "directors": ["Diretor 1", "Diretor 2"], "genres": ["Animação", "Comédia"], "imdbRating": "7.5", "trailer": "https://example.com/bigbuckbunny_trailer.mp4" } return respond_with(meta) else: return respond_with([]) if __name__ == '__main__': if sistema_operacional == "Windows": app.run(debug=True, port=80) else: app.run(host='::', port=8100)
can you provide some info about the error you're getting?
I found the problem, I needed to release cors for stremio in manifest.json
I'm trying to create a stremio addon with flask but I get an error when trying to add it to stremio
my code: