[addon] add option to not show debrid catalog

This commit is contained in:
TheBeastLT
2021-02-07 10:47:48 +01:00
parent f49786d9c2
commit 63ffa653a5
2 changed files with 13 additions and 3 deletions

View File

@@ -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];

View File

@@ -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 }