Upgrade epg-grabber package

This commit is contained in:
Aleksandr Statciuk 2022-01-25 18:25:48 +03:00
parent 9b16df78ed
commit bca943f16a
3 changed files with 10 additions and 11 deletions

14
package-lock.json generated
View file

@ -12,7 +12,7 @@
"commander": "^8.2.0", "commander": "^8.2.0",
"csv-parser": "^3.0.0", "csv-parser": "^3.0.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"epg-grabber": "^0.18.0", "epg-grabber": "^0.19.0",
"epg-parser": "^0.1.6", "epg-parser": "^0.1.6",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"glob": "^7.2.0", "glob": "^7.2.0",
@ -2007,9 +2007,9 @@
} }
}, },
"node_modules/epg-grabber": { "node_modules/epg-grabber": {
"version": "0.18.0", "version": "0.19.0",
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.18.0.tgz", "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.19.0.tgz",
"integrity": "sha512-E+aKgjlMxAjGN3YdrJmP57l/NEffGlfi/mb8uy71jqnkcpB9bOpFKae7zM2G5a5v3Lpk7E8L618qkjeI3jCu1g==", "integrity": "sha512-qXqvhlfT9dqw7L/yo/VaSi4LETCrnQst21YPAqNTmbSsjCeABxF/MfvY5dtJVKf31TfMt0/aK5hPLGmYOsb9mA==",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"axios-cookiejar-support": "^1.0.1", "axios-cookiejar-support": "^1.0.1",
@ -6426,9 +6426,9 @@
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
}, },
"epg-grabber": { "epg-grabber": {
"version": "0.18.0", "version": "0.19.0",
"resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.18.0.tgz", "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.19.0.tgz",
"integrity": "sha512-E+aKgjlMxAjGN3YdrJmP57l/NEffGlfi/mb8uy71jqnkcpB9bOpFKae7zM2G5a5v3Lpk7E8L618qkjeI3jCu1g==", "integrity": "sha512-qXqvhlfT9dqw7L/yo/VaSi4LETCrnQst21YPAqNTmbSsjCeABxF/MfvY5dtJVKf31TfMt0/aK5hPLGmYOsb9mA==",
"requires": { "requires": {
"axios": "^0.21.1", "axios": "^0.21.1",
"axios-cookiejar-support": "^1.0.1", "axios-cookiejar-support": "^1.0.1",

View file

@ -19,7 +19,7 @@
"commander": "^8.2.0", "commander": "^8.2.0",
"csv-parser": "^3.0.0", "csv-parser": "^3.0.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"epg-grabber": "^0.18.0", "epg-grabber": "^0.19.0",
"epg-parser": "^0.1.6", "epg-parser": "^0.1.6",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"glob": "^7.2.0", "glob": "^7.2.0",

View file

@ -32,15 +32,14 @@ async function getChannels() {
const files = await file.list(options.channels) const files = await file.list(options.channels)
for (const filepath of files) { for (const filepath of files) {
const dir = file.dirname(filepath) const dir = file.dirname(filepath)
const filename = file.basename(filepath) const { site, channels: items } = await parser.parseChannels(filepath)
const [_, site] = filename.match(/([a-z0-9-.]+)_/i) || [null, null]
if (!site) continue if (!site) continue
const configPath = `${dir}/${site}.config.js` const configPath = `${dir}/${site}.config.js`
const config = require(file.resolve(configPath)) const config = require(file.resolve(configPath))
if (config.ignore) continue if (config.ignore) continue
const filename = file.basename(filepath)
const [__, region] = filename.match(/_([a-z-]+)\.channels\.xml/i) || [null, null] const [__, region] = filename.match(/_([a-z-]+)\.channels\.xml/i) || [null, null]
const groupId = `${region}/${site}` const groupId = `${region}/${site}`
const items = await parser.parseChannels(filepath)
for (const item of items) { for (const item of items) {
if (!item.site || !item.site_id || !item.xmltv_id || !item.name) continue if (!item.site || !item.site_id || !item.xmltv_id || !item.name) continue
const key = `${item.site}:${item.site_id}` const key = `${item.site}:${item.site_id}`