[Bot] Update playlists (#4600)

* Update Playlist.js

* Install axios package

* Create epg.js

* Update db.js

* Update format.js

* Update Channel.js

* Update db.js

* Update generate.js

* [Bot] Format playlists

* [Bot] Remove duplicates

* [Bot] Sort channels

* [Bot] Update README.md

* [Bot] Format playlists

* [Bot] Remove duplicates

* [Bot] Sort channels

* [Bot] Update README.md

Co-authored-by: Aleksandr Statciuk <free.arhey@gmail.com>
Co-authored-by: iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>
This commit is contained in:
iptv-bot[bot] 2021-09-17 13:29:47 +00:00 committed by GitHub
parent df7907497b
commit 3e2bddab82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 255 additions and 202 deletions

View file

@ -2,15 +2,21 @@ const categories = require('../data/categories')
const parser = require('./parser')
const utils = require('./utils')
const file = require('./file')
const epg = require('./epg')
const db = {}
db.load = async function () {
let files = await file.list()
const files = await file.list()
const codes = await epg.codes.load()
for (const file of files) {
const playlist = await parser.parsePlaylist(file)
db.playlists.add(playlist)
for (const channel of playlist.channels) {
const code = codes.find(ch => ch['tvg_id'] === channel.tvg.id)
if (code && Array.isArray(code.guides) && code.guides.length) {
channel.tvg.url = code.guides[0]
}
db.channels.add(channel)
for (const country of channel.countries) {
@ -25,6 +31,8 @@ db.load = async function () {
}
}
}
db.playlists.add(playlist)
}
}