diff --git a/scripts/commands/generate-playlists.js b/scripts/commands/generate-playlists.js index 20510fbb6c..ebefbae5d9 100644 --- a/scripts/commands/generate-playlists.js +++ b/scripts/commands/generate-playlists.js @@ -68,48 +68,6 @@ async function loadStreams() { }) } -// async function generateIndexCountry() { -// logger.info(`Generating index.country.m3u...`) - -// await generator.generate( -// `${PUBLIC_PATH}/index.country.m3u`, -// {}, -// { -// onLoad: function (items) { -// let results = items -// .filter(item => !item.countries || !item.countries.length) -// .map(item => { -// const newItem = _.cloneDeep(item) -// newItem.group_title = 'Undefined' -// newItem.categories = [] -// return newItem -// }) -// for (const country of _.sortBy(Object.values(countries), ['name'])) { -// let filtered = items -// .filter(item => { -// return ( -// Array.isArray(item.countries) && -// item.countries.map(c => c.code).includes(country.code) -// ) -// }) -// .map(item => { -// const newItem = _.cloneDeep(item) -// newItem.group_title = country.name -// return newItem -// }) -// results = results.concat(filtered) -// } - -// return results -// }, -// sortBy: item => { -// if (item.group_title === 'Undefined') return '_' -// return item.group_title -// } -// } -// ) -// } - // async function generateIndexLanguage() { // logger.info(`Generating index.language.m3u...`) diff --git a/scripts/generators/languages.js b/scripts/generators/languages.js index 74692f9d83..cff825592f 100644 --- a/scripts/generators/languages.js +++ b/scripts/generators/languages.js @@ -2,11 +2,13 @@ const api = require('../core/api') const _ = require('lodash') module.exports = async function (streams = []) { - const output = [] + streams = _.filter(streams, s => !s.channel || s.channel.is_nsfw === false) + await api.languages.load() let languages = await api.languages.all() languages = _.uniqBy(languages, 'code') - streams = _.filter(streams, s => !s.channel || s.channel.is_nsfw === false) + + const output = [] for (const language of languages) { let items = _.filter(streams, { channel: { languages: [language.code] } }) if (items.length) {