mirror of
https://github.com/iptv-org/epg
synced 2026-05-06 09:27:03 -04:00
Fixes
This commit is contained in:
@@ -2,17 +2,6 @@ const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
let EPGGrabber
|
||||
|
||||
async function getEPGGrabber() {
|
||||
if (!EPGGrabber) {
|
||||
EPGGrabber = (await import('epg-grabber')).EPGGrabber
|
||||
}
|
||||
return EPGGrabber
|
||||
}
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
@@ -26,28 +15,6 @@ const tz = {
|
||||
|
||||
module.exports = {
|
||||
site: 'rtp.pt',
|
||||
channels: async () => {
|
||||
const channelsPath = path.resolve(__dirname, 'rtp.pt.channels.xml')
|
||||
|
||||
if (!fs.existsSync(channelsPath)) {
|
||||
console.warn(`Channels file not found: ${channelsPath}. Returning empty list.`)
|
||||
return []
|
||||
}
|
||||
|
||||
const grabber = await getEPGGrabber()
|
||||
const xml = fs.readFileSync(channelsPath, 'utf8')
|
||||
const parsed = grabber.parseChannelsXML(xml)
|
||||
|
||||
return parsed.map(channel => ({
|
||||
xmltv_id: channel.xmltv_id,
|
||||
name: channel.name,
|
||||
site_id: channel.site_id,
|
||||
lang: channel.lang,
|
||||
logo: channel.logo,
|
||||
url: channel.url,
|
||||
lcn: channel.lcn
|
||||
}))
|
||||
},
|
||||
days: 2,
|
||||
|
||||
url({ channel, date }) {
|
||||
|
||||
Reference in New Issue
Block a user