mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update create.js
This commit is contained in:
parent
259a8100f7
commit
ec57059055
1 changed files with 2 additions and 22 deletions
|
@ -48,20 +48,9 @@ async function createQueue() {
|
||||||
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}`
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
if (!item.site || !item.site_id || !item.xmltv_id) continue
|
if (!item.site || !item.xmltv_id) continue
|
||||||
const channel = api.channels.find({ id: item.xmltv_id })
|
const channel = api.channels.find({ id: item.xmltv_id })
|
||||||
if (!channel) {
|
if (!channel) continue
|
||||||
await logError(groupId, {
|
|
||||||
xmltv_id: item.xmltv_id,
|
|
||||||
site: item.site,
|
|
||||||
site_id: item.site_id,
|
|
||||||
lang: item.lang,
|
|
||||||
date: undefined,
|
|
||||||
error: 'The channel has the wrong xmltv_id'
|
|
||||||
})
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const d of dates) {
|
for (const d of dates) {
|
||||||
const dString = d.toJSON()
|
const dString = d.toJSON()
|
||||||
const key = `${item.site}:${item.lang}:${item.xmltv_id}:${dString}`
|
const key = `${item.site}:${item.lang}:${item.xmltv_id}:${dString}`
|
||||||
|
@ -123,12 +112,3 @@ function split(arr, n) {
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
async function logError(key, data) {
|
|
||||||
const filepath = `${LOGS_DIR}/errors/${key}.log`
|
|
||||||
if (!(await file.exists(filepath))) {
|
|
||||||
await file.create(filepath)
|
|
||||||
}
|
|
||||||
|
|
||||||
await file.append(filepath, JSON.stringify(data) + '\r\n')
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue