mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 01:50:04 -04:00
Update playlist/update.js
This commit is contained in:
parent
004a736297
commit
e2046899e9
3 changed files with 17 additions and 13 deletions
|
@ -5,15 +5,16 @@ const _ = require('lodash')
|
|||
|
||||
async function main() {
|
||||
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')
|
||||
let streams = await db.streams.find({})
|
||||
streams = orderBy(
|
||||
streams,
|
||||
['channel_name', i => i.status.level, i => i.resolution.height, 'url'],
|
||||
['asc', 'asc', 'desc', 'asc']
|
||||
)
|
||||
|
||||
const files = _.groupBy(streams, 'filepath')
|
||||
for (const filepath in files) {
|
||||
let items = files[filepath]
|
||||
items = orderBy(items, ['channel_name'], ['asc'])
|
||||
const playlist = createPlaylist(items, { public: false })
|
||||
const playlist = createPlaylist(files[filepath], { public: false })
|
||||
await file.create(filepath, playlist.toString())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue