mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 18:10:04 -04:00
Create subfolders for commands
This commit is contained in:
parent
5ec8619268
commit
c03095f762
24 changed files with 60 additions and 493 deletions
21
scripts/commands/playlist/update.js
Normal file
21
scripts/commands/playlist/update.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const { create: createPlaylist } = require('../../core/playlist')
|
||||
const { db, logger, file } = require('../../core')
|
||||
const { orderBy } = require('natural-orderby')
|
||||
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')
|
||||
|
||||
for (const filepath in files) {
|
||||
let items = files[filepath]
|
||||
items = orderBy(items, ['channel_name'], ['asc'])
|
||||
const playlist = createPlaylist(items, { public: false })
|
||||
await file.create(filepath, playlist.toString())
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue