Update db.js
This commit is contained in:
parent
cdcd0b0907
commit
919ba2f8c7
@ -2,6 +2,8 @@ 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 = function () {
|
||||||
@ -38,7 +40,7 @@ db.channels = {
|
|||||||
if (this.filter) {
|
if (this.filter) {
|
||||||
switch (this.filter.field) {
|
switch (this.filter.field) {
|
||||||
case 'countries':
|
case 'countries':
|
||||||
if (!this.filter.value) {
|
if (this.filter.value === 'undefined') {
|
||||||
output = this.list.filter(channel => !channel.countries.length)
|
output = this.list.filter(channel => !channel.countries.length)
|
||||||
} else {
|
} else {
|
||||||
output = this.list.filter(channel =>
|
output = this.list.filter(channel =>
|
||||||
@ -47,7 +49,7 @@ db.channels = {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'languages':
|
case 'languages':
|
||||||
if (!this.filter.value) {
|
if (this.filter.value === 'undefined') {
|
||||||
output = this.list.filter(channel => !channel.languages.length)
|
output = this.list.filter(channel => !channel.languages.length)
|
||||||
} else {
|
} else {
|
||||||
output = this.list.filter(channel =>
|
output = this.list.filter(channel =>
|
||||||
@ -56,7 +58,7 @@ db.channels = {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'category':
|
case 'category':
|
||||||
if (!this.filter.value) {
|
if (this.filter.value === 'other') {
|
||||||
output = this.list.filter(channel => !channel.category)
|
output = this.list.filter(channel => !channel.category)
|
||||||
} else {
|
} else {
|
||||||
output = this.list.filter(
|
output = this.list.filter(
|
||||||
@ -77,8 +79,6 @@ db.channels = {
|
|||||||
return this.list
|
return this.list
|
||||||
},
|
},
|
||||||
sfw() {
|
sfw() {
|
||||||
const sfwCategories = categories.filter(c => !c.nsfw).map(c => c.name)
|
|
||||||
|
|
||||||
return this.list.filter(i => sfwCategories.includes(i.category))
|
return this.list.filter(i => sfwCategories.includes(i.category))
|
||||||
},
|
},
|
||||||
forCountry(country) {
|
forCountry(country) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user