mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
21 lines
730 B
JavaScript
21 lines
730 B
JavaScript
const { DebridOptions } = require('../moch/options');
|
|
const { QualityFilter } = require('./filter');
|
|
|
|
const keysToSplit = ['providers', QualityFilter.key, DebridOptions.key];
|
|
|
|
function parseConfiguration(configuration) {
|
|
const configValues = configuration.split('|')
|
|
.reduce((map, next) => {
|
|
const parameterParts = next.split('=');
|
|
if (parameterParts.length === 2) {
|
|
map[parameterParts[0].toLowerCase()] = parameterParts[1];
|
|
}
|
|
return map;
|
|
}, {});
|
|
keysToSplit
|
|
.filter(key => configValues[key])
|
|
.filter(key => configValues[key] = configValues[key].split(',').map(provider => provider.toLowerCase()))
|
|
return configValues;
|
|
}
|
|
|
|
module.exports = parseConfiguration; |