Update db.js

This commit is contained in:
Aleksandr Statciuk 2021-08-01 20:31:46 +03:00
parent 95bf8ae6e9
commit 61b2a014f7
1 changed files with 2 additions and 7 deletions

View File

@ -2,14 +2,12 @@ const categories = require('./categories')
const parser = require('./parser') const parser = require('./parser')
const utils = require('./utils') const utils = require('./utils')
const sfwCategories = categories.filter(c => !c.nsfw).map(c => c.name)
const db = {} const db = {}
db.load = function () { db.load = async function () {
const items = parser.parseIndex() const items = parser.parseIndex()
for (const item of items) { for (const item of items) {
const playlist = parser.parsePlaylist(item.url) const playlist = await parser.parsePlaylist(item.url)
db.playlists.add(playlist) db.playlists.add(playlist)
for (const channel of playlist.channels) { for (const channel of playlist.channels) {
db.channels.add(channel) db.channels.add(channel)
@ -107,9 +105,6 @@ db.channels = {
all() { all() {
return this.list return this.list
}, },
sfw() {
return this.list.filter(i => sfwCategories.includes(i.category))
},
forCountry(country) { forCountry(country) {
this.filter = { this.filter = {
field: 'countries', field: 'countries',