iptv/scripts/commands/database/matrix.js

17 lines
418 B
JavaScript
Raw Normal View History

2022-02-12 23:38:07 +01:00
const { logger, db } = require('../../core')
async function main() {
await db.streams.load()
const docs = await db.streams.find({}).sort({ cluster_id: 1 })
const cluster_id = docs.reduce((acc, curr) => {
if (!acc.includes(curr.cluster_id)) acc.push(curr.cluster_id)
return acc
}, [])
const matrix = { cluster_id }
2023-01-20 22:58:41 +01:00
const output = `MATRIX=${JSON.stringify(matrix)}`
2022-02-12 23:38:07 +01:00
logger.info(output)
}
main()