mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] adds debrid meta catalogs for RD and AD
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const { MochOptions } = require('../moch/moch');
|
||||
const { Type } = require('./types');
|
||||
|
||||
const Providers = [
|
||||
'YTS',
|
||||
@@ -12,6 +13,7 @@ const Providers = [
|
||||
'NyaaPantsu'
|
||||
];
|
||||
const DefaultProviders = Providers
|
||||
const CatalogMochs = [MochOptions.realdebrid, MochOptions.alldebrid];
|
||||
|
||||
function manifest(config = {}) {
|
||||
const providersList = config.providers && config.providers.map(provider => getProvider(provider)) || DefaultProviders;
|
||||
@@ -26,15 +28,14 @@ function manifest(config = {}) {
|
||||
const mochsDesc = enabledMochs ? ` and ${enabledMochs} enabled ` : '';
|
||||
return {
|
||||
id: 'com.stremio.torrentio.addon',
|
||||
version: '0.0.6',
|
||||
version: '0.0.7',
|
||||
name: 'Torrentio',
|
||||
description: 'Provides torrent streams from scraped torrent providers.'
|
||||
+ ` Currently supports ${enabledProvidersDesc}${mochsDesc}.`
|
||||
+ ` To configure providers, ${possibleMochs} support and other settings visit https://torrentio.strem.fun`,
|
||||
catalogs: [],
|
||||
resources: ['stream'],
|
||||
types: ['movie', 'series'],
|
||||
idPrefixes: ['tt', 'kitsu'],
|
||||
catalogs: getCatalogs(config),
|
||||
resources: getResources(config),
|
||||
types: [Type.MOVIE, Type.SERIES, Type.OTHER],
|
||||
background: `https://i.ibb.co/VtSfFP9/t8wVwcg.jpg`,
|
||||
logo: `https://i.ibb.co/w4BnkC9/GwxAcDV.png`,
|
||||
behaviorHints: {
|
||||
@@ -44,8 +45,42 @@ function manifest(config = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function dummyManifest() {
|
||||
const manifestDefault = manifest();
|
||||
manifestDefault.catalogs = [{ id: 'dummy', type: Type.OTHER }];
|
||||
manifestDefault.resources = ['stream', 'meta'];
|
||||
return manifestDefault;
|
||||
}
|
||||
|
||||
function getProvider(configProvider) {
|
||||
return Providers.find(provider => provider.toLowerCase() === configProvider);
|
||||
}
|
||||
|
||||
module.exports = { manifest, Providers, DefaultProviders };
|
||||
function getCatalogs(config) {
|
||||
return CatalogMochs
|
||||
.filter(moch => config[moch.key])
|
||||
.map(moch => ({
|
||||
id: `torrentio-${moch.key}`,
|
||||
name: `${moch.name}`,
|
||||
type: 'other',
|
||||
}));
|
||||
}
|
||||
|
||||
function getResources(config) {
|
||||
const streamResource = {
|
||||
name: 'stream',
|
||||
types: [Type.MOVIE, Type.SERIES],
|
||||
idPrefixes: ['tt', 'kitsu']
|
||||
};
|
||||
const metaResource = {
|
||||
name: 'meta',
|
||||
types: [Type.OTHER],
|
||||
idPrefixes: CatalogMochs.filter(moch => config[moch.key]).map(moch => moch.key)
|
||||
};
|
||||
if (CatalogMochs.filter(moch => config[moch.key]).length) {
|
||||
return [streamResource, metaResource];
|
||||
}
|
||||
return [streamResource];
|
||||
}
|
||||
|
||||
module.exports = { manifest, dummyManifest, Providers, DefaultProviders };
|
||||
@@ -15,7 +15,7 @@ function getRandomProxy() {
|
||||
if (PROXY_HOSTS && PROXY_HOSTS.length && PROXY_USERNAME && PROXY_PASSWORD) {
|
||||
const index = new Date().getHours() % PROXY_HOSTS.length;
|
||||
const proxyHost = PROXY_HOSTS[index];
|
||||
console.log(`${new Date()} Using ${proxyHost} proxy`);
|
||||
console.log(`${new Date().toISOString()} Using ${proxyHost} proxy`);
|
||||
return `https://${PROXY_USERNAME}:${PROXY_PASSWORD}@${proxyHost}:${PROXY_PORT}`;
|
||||
}
|
||||
console.warn('No proxy configured!');
|
||||
@@ -28,7 +28,7 @@ function getProxyAgent(proxy) {
|
||||
|
||||
function blacklistProxy(proxy) {
|
||||
const proxyHost = proxy.replace(/.*@/, '');
|
||||
console.warn(`${new Date()} Blacklisting ${proxyHost}`);
|
||||
console.warn(`${new Date().toISOString()} Blacklisting ${proxyHost}`);
|
||||
if (PROXY_HOSTS && PROXY_HOSTS.indexOf(proxyHost) > -1) {
|
||||
PROXY_HOSTS.splice(PROXY_HOSTS.indexOf(proxyHost), 1);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
exports.Type = {
|
||||
MOVIE: 'movie',
|
||||
SERIES: 'series',
|
||||
ANIME: 'anime'
|
||||
ANIME: 'anime',
|
||||
OTHER: 'other'
|
||||
};
|
||||
Reference in New Issue
Block a user