[addon] adds sorting and limit options

This commit is contained in:
TheBeastLT
2020-03-19 16:11:54 +01:00
parent 0e4c65e203
commit e8390ad2a5
4 changed files with 125 additions and 70 deletions

23
addon/moch/moch.js Normal file
View 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;