mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 18:10:04 -04:00
Create scripts/commands
This commit is contained in:
parent
b775228d1e
commit
213da67762
9 changed files with 939 additions and 0 deletions
17
scripts/commands/update-playlists.js
Normal file
17
scripts/commands/update-playlists.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const _ = require('lodash')
|
||||
const { generator, db, logger } = require('../core')
|
||||
|
||||
async function main() {
|
||||
let items = await db
|
||||
.find({})
|
||||
.sort({ name: 1, 'status.level': 1, 'resolution.height': -1, url: 1 })
|
||||
items = _.uniqBy(items, 'url')
|
||||
const files = _.groupBy(items, 'filepath')
|
||||
|
||||
for (const filepath in files) {
|
||||
const items = files[filepath]
|
||||
await generator.saveAsM3U(filepath, items, { includeGuides: false })
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue