mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 02:20:03 -04:00
Update generate-playlists.js
This commit is contained in:
parent
96403d463e
commit
62ce78bbdf
32 changed files with 187 additions and 117 deletions
|
@ -5,15 +5,18 @@ module.exports = async function (streams = []) {
|
|||
const output = []
|
||||
await api.regions.load()
|
||||
const regions = await api.regions.all()
|
||||
streams = _.filter(streams, s => !s.channel || s.channel.is_nsfw === false)
|
||||
streams = _.filter(streams, stream => !stream.channel || stream.channel.is_nsfw === false)
|
||||
for (const region of regions) {
|
||||
const areaCodes = region.countries
|
||||
areaCodes.push(region.code)
|
||||
let items = _.filter(streams, s => _.intersection(areaCodes, s.broadcast_area).length)
|
||||
const areaCodes = region.countries.map(code => `c/${code}`)
|
||||
areaCodes.push(`r/${region.code}`)
|
||||
let items = _.filter(
|
||||
streams,
|
||||
stream => stream.channel && _.intersection(stream.channel.broadcast_area, areaCodes).length
|
||||
)
|
||||
output.push({ filepath: `regions/${region.code.toLowerCase()}.m3u`, items })
|
||||
}
|
||||
|
||||
let items = _.filter(streams, s => !s.broadcast_area.length)
|
||||
let items = _.filter(streams, stream => !stream.channel || !stream.channel.broadcast_area.length)
|
||||
output.push({ filepath: 'regions/undefined.m3u', items })
|
||||
|
||||
return output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue