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