mirror of
https://github.com/iptv-org/epg
synced 2025-12-18 03:16:53 -05:00
Update create.js
This commit is contained in:
@@ -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')
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user