Spaces:
Paused
Paused
Upload 5 files
Browse filesFiles changed (5)
123451 unmodified line78910111213141516171819209 unmodified lines3031323334353 unmodified lines3940414243444546474849505152535441 unmodified lines9697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712 unmodified lines140141142143144145146109 unmodified lines256257258259260261262require('dotenv').config();const { addonBuilder, serveHTTP } = require('stremio-addon-sdk');const axios = require('axios');const fs = require('fs').promises;1 unmodified lineconst winston = require('winston');const schedule = require('node-schedule');// Load environment variablesconst TMDB_API_KEY = process.env.TMDB_API_KEY;const YEAR_START = process.env.YEAR_START || 2015;const YEAR_END = process.env.YEAR_END || 2024;const MIN_SCORE = process.env.MIN_SCORE || 4;const MAX_PAGES = process.env.MAX_PAGES || 10;const PAGE_SIZE = process.env.PAGE_SIZE || 25;// Winston logger configurationconst logger = winston.createLogger({level: 'debug',9 unmodified lines]});const TMDB_BASE_URL = 'https://api.themoviedb.org/3';const CACHE_DIR = path.join(__dirname, 'cache');const CATALOG_CACHE_FILE = path.join(CACHE_DIR, 'catalog_cache.json');3 unmodified lineslet metaCache = {};const manifest = {id: 'org.stremio.action-adventure-comedy-drama-documentary',version: '1.0.0',name: 'Action/Adventure/Comedy/Drama/Documentary Movies',description: 'Stremio Add-on showcasing selected genres with filtering and sorting',catalogs: [{id: 'action-adventure-comedy-drama-documentary-catalog',name: 'Action/Adventure/Comedy/Drama/Documentary Movies',type: 'movie',pageSize: PAGE_SIZE,extra: [{ name: 'search', isRequired: false }]}],41 unmodified lines}}async function fetchMoviesWithNewQuery() {let page = 1;let totalPages = 1;const allResults = [];try {do {const url = `${TMDB_BASE_URL}/discover/movie?api_key=${TMDB_API_KEY}&include_adult=false&include_video=false&language=en&sort_by=primary_release_date.desc&with_genres=28,12,35,18,99&with_original_language=en&without_genres=16,10402&page=${page}&primary_release_date.gte=${YEAR_START}-01-01&primary_release_date.lte=${YEAR_END}-12-31&vote_average.gte=${MIN_SCORE}`;logger.debug(`Requesting TMDB: ${url}`);const response = await axios.get(url);const { results, total_pages } = response.data;totalPages = Math.min(total_pages, MAX_PAGES); // Limit to MAX_PAGESlogger.debug(`Page ${page}/${totalPages} fetched. Results: ${results.length}`);allResults.push(...results);page++;} while (page <= totalPages);allResults.sort((a, b) => new Date(b.release_date) - new Date(a.release_date));logger.info(`Total movies fetched after filtering: ${allResults.length}`);return allResults;} catch (error) {logger.error('Error fetching movies:', error);return [];}}12 unmodified linesasync function updateCatalogAndMetaCache() {logger.info('Updating catalog and meta cache...');try {const results = await fetchMoviesWithNewQuery();catalogCache = {timestamp: Date.now(),data: results109 unmodified lines}const interface = builder.getInterface();const port = process.env.PORT || 3000;logger.info(`Starting Stremio Add-on server on port ${port}`);serveHTTP(interface, { port });1231 unmodified line56789109 unmodified lines202122232425263 unmodified lines3031323334353637383940414243444541 unmodified lines8788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012 unmodified lines133134135136137138139109 unmodified lines249250251252253254255const { addonBuilder, serveHTTP } = require('stremio-addon-sdk');const axios = require('axios');const fs = require('fs').promises;1 unmodified lineconst winston = require('winston');const schedule = require('node-schedule');// Winston logger configurationconst logger = winston.createLogger({level: 'debug',9 unmodified lines]});const TMDB_API_KEY = 'f051e7366c6105ad4f9aafe4733d9dae';const TMDB_BASE_URL = 'https://api.themoviedb.org/3';const CACHE_DIR = path.join(__dirname, 'cache');const CATALOG_CACHE_FILE = path.join(CACHE_DIR, 'catalog_cache.json');3 unmodified lineslet metaCache = {};const manifest = {id: 'org.stremio.uk-comedy-movies',version: '1.0.0',name: 'UK Comedy Movies',description: 'Stremio Add-on to showcase UK comedy movies from 2015 onward with a rating above 4',catalogs: [{id: 'uk-comedy-movies-catalog',name: 'UK Comedy Movies',type: 'Easynews',pageSize: 25,extra: [{ name: 'search', isRequired: false }]}],41 unmodified lines}}async function fetchUKComedyMovies() {let page = 1;let totalPages = 1;const allResults = [];try {do {const url = `${TMDB_BASE_URL}/discover/movie?api_key=${TMDB_API_KEY}&with_genres=35&with_original_language=en&with_origin_country=GB&primary_release_date.gte=2015-01-01&primary_release_date.lte=2024-12-31&page=${page}`;logger.debug(`Requesting TMDB: ${url}`);const response = await axios.get(url);const { results, total_pages } = response.data;totalPages = total_pages;logger.debug(`Page ${page}/${totalPages} fetched. Results: ${results.length}`);// Filter movies with a rating above 4const filteredResults = results.filter(movie => movie.vote_average > 4);allResults.push(...filteredResults);page++;} while (page <= totalPages);allResults.sort((a, b) => new Date(b.release_date) - new Date(a.release_date));logger.info(`Total UK Comedy movies fetched after filtering: ${allResults.length}`);return allResults;} catch (error) {logger.error('Error fetching UK Comedy movies:', error);return [];}}12 unmodified linesasync function updateCatalogAndMetaCache() {logger.info('Updating catalog and meta cache...');try {const results = await fetchUKComedyMovies();catalogCache = {timestamp: Date.now(),data: results109 unmodified lines}const interface = builder.getInterface();const port = process.env.PORT || 1966;logger.info(`Starting Stremio Add-on server on port ${port}`);serveHTTP(interface, { port });
12345678910111213141516326 unmodified lines3433443453463473483493503513523533543553563573583591378 unmodified lines17381739174017411742174317441745174617471748{"name": "stremio-custom-addon","version": "1.2.0","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "stremio-custom-addon","version": "1.2.0","license": "MIT","dependencies": {"axios": "^0.27.2","dotenv": "^16.0.3","node-schedule": "^2.1.0","stremio-addon-sdk": "^1.6.10","winston": "^3.8.2"326 unmodified lines"npm": "1.2.8000 || >= 1.4.16"}},"node_modules/dotenv": {"version": "16.4.5","resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz","integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==","engines": {"node": ">=12"},"funding": {"url": "https://dotenvx.com"}},"node_modules/ee-first": {"version": "1.1.1","resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",1378 unmodified lines"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz","integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="},"dotenv": {"version": "16.4.5","resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz","integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg=="},"ee-first": {"version": "1.1.1","resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",123456789101112131415326 unmodified lines3423433443453463471378 unmodified lines172617271728172917301731{"name": "stremio-ufc-addon","version": "1.2.0","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "stremio-ufc-addon","version": "1.2.0","license": "MIT","dependencies": {"axios": "^0.27.2","node-schedule": "^2.1.0","stremio-addon-sdk": "^1.6.10","winston": "^3.8.2"326 unmodified lines"npm": "1.2.8000 || >= 1.4.16"}},"node_modules/ee-first": {"version": "1.1.1","resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",1378 unmodified lines"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz","integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="},"ee-first": {"version": "1.1.1","resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
12345678910111213141516171 unmodified line1920212223242526{"name": "stremio-custom-addon","version": "1.2.0","description": "Stremio Add-on to showcase custom movies based on TMDB with configurable filters","main": "index.js","scripts": {"start": "node index.js"},"keywords": ["stremio","addon","movies","tmdb","custom"],"author": "Your Name","license": "MIT",1 unmodified line"stremio-addon-sdk": "^1.6.10","axios": "^0.27.2","winston": "^3.8.2","node-schedule": "^2.1.0","dotenv": "^16.0.3"},"engines": {"node": ">=14.0.0"123456789101112131415161 unmodified line18192021222324{"name": "stremio-ufc-addon","version": "1.2.0","description": "Stremio Add-on to showcase UFC movies from TMDB with daily updates","main": "addon.js","scripts": {"start": "node index.js"},"keywords": ["stremio","addon","ufc","movies"],"author": "Your Name","license": "MIT",1 unmodified line"stremio-addon-sdk": "^1.6.10","axios": "^0.27.2","winston": "^3.8.2","node-schedule": "^2.1.0"},"engines": {"node": ">=14.0.0"
cache/catalog_cache.json
cache/meta_cache.json
index.js+18-25
package-lock.json+2-19
package.json+6-8