Update generate-playlists.js
This commit is contained in:
parent
6eaa245792
commit
65e76c926d
|
@ -226,7 +226,7 @@ async function generateIndexLanguage() {
|
||||||
{
|
{
|
||||||
onLoad: function (items) {
|
onLoad: function (items) {
|
||||||
let results = items
|
let results = items
|
||||||
.filter(item => !item.languages.length)
|
.filter(item => !item.languages || !item.languages.length)
|
||||||
.map(item => {
|
.map(item => {
|
||||||
const newItem = _.cloneDeep(item)
|
const newItem = _.cloneDeep(item)
|
||||||
newItem.group_title = ''
|
newItem.group_title = ''
|
||||||
|
@ -235,7 +235,7 @@ async function generateIndexLanguage() {
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
let filtered = items
|
let filtered = items
|
||||||
.filter(item => {
|
.filter(item => {
|
||||||
return item.languages.map(c => c.code).includes(language.code)
|
return item.languages && item.languages.map(c => c.code).includes(language.code)
|
||||||
})
|
})
|
||||||
.map(item => {
|
.map(item => {
|
||||||
const newItem = _.cloneDeep(item)
|
const newItem = _.cloneDeep(item)
|
||||||
|
@ -296,10 +296,10 @@ async function generateChannelsJson() {
|
||||||
async function setUp() {
|
async function setUp() {
|
||||||
logger.info(`Loading database...`)
|
logger.info(`Loading database...`)
|
||||||
const items = await db.find({})
|
const items = await db.find({})
|
||||||
categories = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.categories)), 'slug'), ['name'])
|
categories = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.categories)), 'slug'), ['name']).filter(i => i)
|
||||||
countries = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.countries)), 'code'), ['name'])
|
countries = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.countries)), 'code'), ['name']).filter(i => i)
|
||||||
languages = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.languages)), 'code'), ['name'])
|
languages = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.languages)), 'code'), ['name']).filter(i => i)
|
||||||
regions = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.regions)), 'code'), ['name'])
|
regions = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.regions)), 'code'), ['name']).filter(i => i)
|
||||||
|
|
||||||
const categoriesLog = `${LOGS_PATH}/generate-playlists/categories.log`
|
const categoriesLog = `${LOGS_PATH}/generate-playlists/categories.log`
|
||||||
const countriesLog = `${LOGS_PATH}/generate-playlists/countries.log`
|
const countriesLog = `${LOGS_PATH}/generate-playlists/countries.log`
|
||||||
|
|
Loading…
Reference in New Issue