Update regions.js
This commit is contained in:
parent
c35b3f6aa1
commit
faaac2e627
|
@ -7,9 +7,20 @@ module.exports = async function (streams = []) {
|
|||
await api.regions.load()
|
||||
const regions = await api.regions.all()
|
||||
|
||||
await api.subdivisions.load()
|
||||
const subdivisions = await api.subdivisions.all()
|
||||
|
||||
const output = []
|
||||
for (const region of regions) {
|
||||
const areaCodes = region.countries.map(code => `c/${code}`)
|
||||
const regionCountries = region.countries
|
||||
let areaCodes = regionCountries.map(code => `c/${code}`)
|
||||
|
||||
const regionSubdivisions = _.filter(
|
||||
subdivisions,
|
||||
s => regionCountries.indexOf(s.country) > -1
|
||||
).map(s => `s/${s.code}`)
|
||||
areaCodes = areaCodes.concat(regionSubdivisions)
|
||||
|
||||
areaCodes.push(`r/${region.code}`)
|
||||
|
||||
let items = _.filter(streams, stream => _.intersection(stream.broadcast_area, areaCodes).length)
|
||||
|
|
Loading…
Reference in New Issue