mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
23 lines
579 B
JavaScript
23 lines
579 B
JavaScript
const glob = require('glob')
|
|
|
|
function list(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)
|
|
})
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
list
|
|
}
|