Update generate.js

This commit is contained in:
freearhey 2021-01-27 18:54:08 +03:00
parent ec94896608
commit b303ab4dd5
1 changed files with 13 additions and 0 deletions

View File

@ -18,6 +18,8 @@ function main() {
createNoJekyllFile()
console.log('Generating index.m3u...')
generateIndex()
console.log('Generating index.sfw.m3u...')
generateSFWIndex()
console.log('Generating channels.json...')
generateChannels()
console.log('Generating index.country.m3u...')
@ -118,6 +120,17 @@ function generateIndex() {
}
}
function generateSFWIndex() {
const filename = `${ROOT_DIR}/index.sfw.m3u`
helper.createFile(filename, '#EXTM3U\n')
const sorted = helper.sortBy(list.all, ['name', 'url'])
const channels = helper.filterNSFW(sorted)
for (let channel of channels) {
helper.appendToFile(filename, channel.toString())
}
}
function generateChannels() {
const filename = `${ROOT_DIR}/channels.json`
const sorted = helper.sortBy(list.all, ['name', 'url'])