mirror of
https://github.com/iptv-org/epg
synced 2026-05-11 03:47:02 -04:00
Replace LF endings with CRLF
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
const parser = require('epg-parser')
|
||||
|
||||
module.exports = {
|
||||
site: 'makrodigitaltelevision.com',
|
||||
days: 3,
|
||||
url: 'https://makrodigitaltelevision.com/epg.xml',
|
||||
parser({ content, date, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel, date)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.title?.[0]?.value,
|
||||
start: item.start,
|
||||
stop: item.stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel, date) {
|
||||
const { programs } = parser.parse(content)
|
||||
|
||||
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||
}
|
||||
const parser = require('epg-parser')
|
||||
|
||||
module.exports = {
|
||||
site: 'makrodigitaltelevision.com',
|
||||
days: 3,
|
||||
url: 'https://makrodigitaltelevision.com/epg.xml',
|
||||
parser({ content, date, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel, date)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.title?.[0]?.value,
|
||||
start: item.start,
|
||||
stop: item.stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel, date) {
|
||||
const { programs } = parser.parse(content)
|
||||
|
||||
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||
}
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
const { parser, url } = require('./makrodigitaltelevision.com.config.js')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(utc)
|
||||
|
||||
const date = dayjs.utc('2025-02-16', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = { site_id: '17' }
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://makrodigitaltelevision.com/epg.xml')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results.length).toBe(8)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'Programación Infantil',
|
||||
start: '2025-02-16T13:00:00.000Z',
|
||||
stop: '2025-02-16T17:00:00.000Z'
|
||||
})
|
||||
expect(results[7]).toMatchObject({
|
||||
title: 'Comunicación Cristiana',
|
||||
start: '2025-02-16T23:30:00.000Z',
|
||||
stop: '2025-02-17T00:00:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({ content: '' })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./makrodigitaltelevision.com.config.js')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(utc)
|
||||
|
||||
const date = dayjs.utc('2025-02-16', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = { site_id: '17' }
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://makrodigitaltelevision.com/epg.xml')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results.length).toBe(8)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'Programación Infantil',
|
||||
start: '2025-02-16T13:00:00.000Z',
|
||||
stop: '2025-02-16T17:00:00.000Z'
|
||||
})
|
||||
expect(results[7]).toMatchObject({
|
||||
title: 'Comunicación Cristiana',
|
||||
start: '2025-02-16T23:30:00.000Z',
|
||||
stop: '2025-02-17T00:00:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({ content: '' })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user