mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 01:50:04 -04:00
Update playlist/generate.js
This commit is contained in:
parent
0d1ab5dfe9
commit
081fcac929
17 changed files with 273 additions and 274 deletions
|
@ -1,9 +1,7 @@
|
|||
const { create: createPlaylist } = require('./playlist')
|
||||
const generators = require('../generators')
|
||||
const logger = require('./logger')
|
||||
const file = require('./file')
|
||||
const generators = require('../generators')
|
||||
const _ = require('lodash')
|
||||
const { orderBy } = require('natural-orderby')
|
||||
|
||||
const PUBLIC_DIR = process.env.PUBLIC_DIR || '.gh-pages'
|
||||
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs/generators'
|
||||
|
@ -13,12 +11,6 @@ const generator = {}
|
|||
generator.generate = async function (name, streams = []) {
|
||||
if (typeof generators[name] === 'function') {
|
||||
try {
|
||||
streams = orderBy(
|
||||
streams,
|
||||
['channel_name', 'status.level', 'resolution.height'],
|
||||
['asc', 'asc', 'desc']
|
||||
)
|
||||
streams = _.uniqBy(streams, stream => stream.channel_id || _.uniqueId())
|
||||
let output = await generators[name].bind()(streams)
|
||||
output = Array.isArray(output) ? output : [output]
|
||||
for (const type of output) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue