mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 18:10:04 -04:00
wip
This commit is contained in:
parent
109deb476d
commit
bad3eddf9d
25 changed files with 453 additions and 447 deletions
19
scripts/generators/regions.js
Normal file
19
scripts/generators/regions.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const api = require('../core/api')
|
||||
const _ = require('lodash')
|
||||
|
||||
module.exports = async function (streams = []) {
|
||||
const output = []
|
||||
await api.regions.load()
|
||||
const regions = await api.regions.all()
|
||||
for (const region of regions) {
|
||||
const areaCodes = region.countries
|
||||
areaCodes.push(region.code)
|
||||
let items = _.filter(streams, s => _.intersection(areaCodes, s.broadcast_area).length)
|
||||
output.push({ id: region.code.toLowerCase(), items })
|
||||
}
|
||||
|
||||
let items = _.filter(streams, s => !s.broadcast_area.length)
|
||||
output.push({ id: 'undefined', items })
|
||||
|
||||
return output
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue