Update create-matrix.js

This commit is contained in:
Aleksandr Statciuk 2021-10-15 00:58:42 +03:00
parent a3a0bf0854
commit 781e093d46

View file

@ -1,6 +1,6 @@
const { Command } = require('commander') const { Command } = require('commander')
const file = require('./file') const file = require('./file')
const parser = require('./parser') const grabber = require('epg-grabber')
const program = new Command() const program = new Command()
program program
@ -16,13 +16,13 @@ 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 channelsFile = file.read(filename) const channelsFile = file.read(filename)
const parsed = parser.parseChannels(channelsFile) const parsed = grabber.parseChannels(channelsFile)
parsed.groups.forEach(group => { matrix.guide.push({
matrix.guide.push({ site: parsed.site,
site: parsed.site, country
country: group.country.toLowerCase()
})
}) })
}) })