mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 18:10:04 -04:00
Update generate-playlist.js
This commit is contained in:
parent
442916d130
commit
5ec8619268
65 changed files with 246 additions and 156 deletions
|
@ -2,15 +2,16 @@ const api = require('../core/api')
|
|||
const _ = require('lodash')
|
||||
|
||||
module.exports = async function (streams = []) {
|
||||
const output = []
|
||||
await api.categories.load()
|
||||
const categories = await api.categories.all()
|
||||
|
||||
const output = []
|
||||
for (const category of categories) {
|
||||
let items = _.filter(streams, { channel: { categories: [category.id] } })
|
||||
let items = _.filter(streams, { categories: [{ id: category.id }] })
|
||||
output.push({ filepath: `categories/${category.id}.m3u`, items })
|
||||
}
|
||||
|
||||
let items = _.filter(streams, stream => !stream.channel || !stream.channel.categories.length)
|
||||
let items = _.filter(streams, stream => !stream.categories.length)
|
||||
output.push({ filepath: 'categories/undefined.m3u', items })
|
||||
|
||||
return output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue