Update create-matrix.js

This commit is contained in:
Aleksandr Statciuk 2021-10-28 22:57:59 +03:00
parent b6e5da0bcb
commit faaa83c3ce

View file

@ -1,6 +1,5 @@
const { Command } = require('commander') const { Command } = require('commander')
const file = require('./file') const file = require('./file')
const grabber = require('epg-grabber')
const program = new Command() const program = new Command()
program program
@ -16,14 +15,9 @@ file.list('sites/*/*.channels.xml', options.include, options.exclude).then(files
} }
files.forEach(filename => { files.forEach(filename => {
const country = filename.match(/sites\/.*\/.*_(.*)\.channels\.xml/i)[1] const [_, site, country] = filename.match(/sites\/.*\/(.*)_(.*)\.channels\.xml/i)
const channelsFile = file.read(filename) matrix.guide.push({ site, country })
const parsed = grabber.parseChannels(channelsFile)
matrix.guide.push({
site: parsed.site,
country
})
}) })
const output = `::set-output name=matrix::${JSON.stringify(matrix)}` const output = `::set-output name=matrix::${JSON.stringify(matrix)}`