mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 01:50:04 -04:00
Update update-playlist.js
This commit is contained in:
parent
c2b557c34c
commit
a728d3d5a5
2 changed files with 19 additions and 20 deletions
|
@ -1,15 +1,18 @@
|
|||
const _ = require('lodash')
|
||||
const { generator, db, logger } = require('../core')
|
||||
const { create: createPlaylist } = require('../core/playlist')
|
||||
const { db, logger, file } = require('../core')
|
||||
|
||||
async function main() {
|
||||
let items = await db
|
||||
await db.streams.load()
|
||||
let items = await db.streams
|
||||
.find({})
|
||||
.sort({ name: 1, 'status.level': 1, 'resolution.height': -1, url: 1 })
|
||||
const files = _.groupBy(items, 'filepath')
|
||||
|
||||
for (const filepath in files) {
|
||||
const items = files[filepath]
|
||||
await generator.saveAsM3U(filepath, items)
|
||||
const playlist = createPlaylist(items, { public: false })
|
||||
await file.create(filepath, playlist.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue