mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] adds sorting and limit options
This commit is contained in:
23
addon/moch/moch.js
Normal file
23
addon/moch/moch.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const realdebrid = require('./realdebrid');
|
||||
|
||||
const MOCHS = {
|
||||
'realdebrid': realdebrid
|
||||
};
|
||||
|
||||
async function applyMochs(streams, config) {
|
||||
if (!streams || !streams.length) {
|
||||
return streams;
|
||||
}
|
||||
|
||||
return Object.keys(config)
|
||||
.filter(configKey => MOCHS[configKey])
|
||||
.reduce(async (streams, moch) => {
|
||||
return await MOCHS[moch].applyMoch(streams, config[moch])
|
||||
.catch(error => {
|
||||
console.warn(error);
|
||||
return streams;
|
||||
});
|
||||
}, streams);
|
||||
}
|
||||
|
||||
module.exports = applyMochs;
|
||||
Reference in New Issue
Block a user