mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update create-matrix.js
This commit is contained in:
parent
9ab5cb9eea
commit
d97b53970e
1 changed files with 2 additions and 19 deletions
|
@ -1,27 +1,10 @@
|
||||||
const glob = require('glob')
|
const glob = require('glob')
|
||||||
|
const file = require('./file.js')
|
||||||
|
|
||||||
fileList(['ad'], []).then(files => {
|
file.list(['ad'], []).then(files => {
|
||||||
const country = files.map(file => file.replace(/channels\/|\.xml/gi, ''))
|
const country = files.map(file => file.replace(/channels\/|\.xml/gi, ''))
|
||||||
const days = country.map(() => 2)
|
const days = country.map(() => 2)
|
||||||
const matrix = { country, days }
|
const matrix = { country, days }
|
||||||
const output = `::set-output name=matrix::${JSON.stringify(matrix)}`
|
const output = `::set-output name=matrix::${JSON.stringify(matrix)}`
|
||||||
console.log(output)
|
console.log(output)
|
||||||
})
|
})
|
||||||
|
|
||||||
function fileList(include = [], exclude = []) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
glob('channels/**/*.xml', function (err, files) {
|
|
||||||
if (include.length) {
|
|
||||||
include = include.map(filename => `channels/${filename}.xml`)
|
|
||||||
files = files.filter(filename => include.includes(filename))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exclude.length) {
|
|
||||||
exclude = exclude.map(filename => `channels/${filename}.xml`)
|
|
||||||
files = files.filter(filename => !exclude.includes(filename))
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(files)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue