mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] add option to not show debrid catalog
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const { MochOptions } = require('../moch/moch');
|
||||
const { showDebridCatalog } = require('../moch/options');
|
||||
const { Type } = require('./types');
|
||||
|
||||
const Providers = [
|
||||
@@ -58,7 +59,7 @@ function getProvider(configProvider) {
|
||||
|
||||
function getCatalogs(config) {
|
||||
return CatalogMochs
|
||||
.filter(moch => config[moch.key])
|
||||
.filter(moch => showDebridCatalog(config) && config[moch.key])
|
||||
.map(moch => ({
|
||||
id: `torrentio-${moch.key}`,
|
||||
name: `${moch.name}`,
|
||||
@@ -77,7 +78,7 @@ function getResources(config) {
|
||||
types: [Type.OTHER],
|
||||
idPrefixes: CatalogMochs.filter(moch => config[moch.key]).map(moch => moch.key)
|
||||
};
|
||||
if (CatalogMochs.filter(moch => config[moch.key]).length) {
|
||||
if (showDebridCatalog(config) && CatalogMochs.filter(moch => config[moch.key]).length) {
|
||||
return [streamResource, metaResource];
|
||||
}
|
||||
return [streamResource];
|
||||
|
||||
@@ -5,6 +5,10 @@ const DebridOptions = {
|
||||
key: 'nodownloadlinks',
|
||||
description: 'Don\'t show download to debrid links'
|
||||
},
|
||||
noCatalog: {
|
||||
key: 'nocatalog',
|
||||
description: 'Don\'t show debrid catalog'
|
||||
},
|
||||
torrentLinks: {
|
||||
key: 'torrentlinks',
|
||||
description: 'Show P2P torrent links for uncached'
|
||||
@@ -22,4 +26,9 @@ function includeTorrentLinks(config) {
|
||||
.includes(DebridOptions.options.torrentLinks.key);
|
||||
}
|
||||
|
||||
module.exports = { DebridOptions, excludeDownloadLinks, includeTorrentLinks }
|
||||
function showDebridCatalog(config) {
|
||||
return !(config[DebridOptions.key] && config[DebridOptions.key]
|
||||
.includes(DebridOptions.options.noCatalog.key));
|
||||
}
|
||||
|
||||
module.exports = { DebridOptions, excludeDownloadLinks, showDebridCatalog, includeTorrentLinks }
|
||||
Reference in New Issue
Block a user