[addon] adds debrid download link option an logic

This commit is contained in:
TheBeastLT
2020-05-10 21:33:53 +02:00
parent 3662eda2bc
commit 0c8c813756
5 changed files with 82 additions and 35 deletions

34
addon/moch/options.js Normal file
View File

@@ -0,0 +1,34 @@
const DebridOptions = {
key: 'debridoptions',
options: {
cachedlinks: {
key: 'cachedlinks',
description: 'Show only cached debrid links'
},
cachedlinksifavailable: {
key: 'cachedlinksifavailable',
description: 'Show only cached debrid links if available'
},
downloadlinks: {
key: 'downloadlinks',
description: 'Show download to debrid links for uncached'
}
}
}
function onlyCachedLinks(config) {
return config[DebridOptions.key] && config[DebridOptions.key]
.includes(DebridOptions.options.cachedlinks.key);
}
function onlyCachedLinksIfAvailable(config) {
return config[DebridOptions.key] && config[DebridOptions.key]
.includes(DebridOptions.options.cachedlinksifavailable.key);
}
function includeDownloadLinks(config) {
return config[DebridOptions.key] && config[DebridOptions.key]
.includes(DebridOptions.options.downloadlinks.key);
}
module.exports = { DebridOptions, onlyCachedLinks, onlyCachedLinksIfAvailable, includeDownloadLinks }