From 35c03ca323f0ac9441e50206e8461fffc044fd92 Mon Sep 17 00:00:00 2001 From: freearhey Date: Sat, 2 Nov 2019 00:21:08 +0300 Subject: [PATCH] wip --- helpers/generate.js | 48 ++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/helpers/generate.js b/helpers/generate.js index e87c55cda..715675d8e 100644 --- a/helpers/generate.js +++ b/helpers/generate.js @@ -120,6 +120,28 @@ function generateFullIndex() { } } +function generateCategories() { + for(let cid in list.categories) { + let category = list.categories[cid] + const filename = `categories/${cid}.m3u` + util.createFile(filename, '#EXTM3U\n') + for(let channel of category) { + util.appendToFile(filename, channel.toString()) + } + } +} + +function generateLanguages() { + for(let lid in list.languages) { + let language = list.languages[lid] + const filename = `languages/${lid}.m3u` + util.createFile(filename, '#EXTM3U\n') + for(let channel of language) { + util.appendToFile(filename, channel.toString()) + } + } +} + function main() { console.log(`Parsing index...`) parseIndex() @@ -131,30 +153,12 @@ function main() { generateContentIndex() console.log('Generating index.full.m3u...') generateFullIndex() + console.log('Generating /categories...') + generateCategories() + console.log('Generating /languages...') + generateLanguages() // console.log(output) - // let group = channel.group - // for(const type of types) { - // if(type === 'full') { - // channel.group = [ c.name, channel.group ].filter(i => i).join(';') - // } else if(type === 'country') { - // channel.group = c.name - // } else if(type === 'language') { - // channel.group = channel.language - // } else { - // channel.group = group - // } - - // util.appendToFile(`index.${type}.m3u`, channel.toString()) - // } - - - // for(let type of types) { - // const filename = `index.${type}.m3u` - // console.log(`Creating '${filename}'...`) - // util.createFile(filename, '#EXTM3U\n') - // } - // const categories = util.supportedCategories // for(let category of categories) { // const categoryCode = category.toLowerCase()