Merge pull request #3132 from iptv-org/add-epg.tmacaraibes.com

Add epg.tmacaraibes.com
This commit is contained in:
Ismaël Moret
2026-05-09 14:05:37 +02:00
committed by GitHub
5 changed files with 6086 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="epg.tmacaraibes.com" site_id="TMA.gp@SD" lang="fr" xmltv_id="TMA.gp@SD">TMA</channel>
</channels>

View File

@@ -0,0 +1,41 @@
const parser = require('epg-parser')
module.exports = {
site: 'epg.tmacaraibes.com',
days: 2,
url: 'https://epg.tmacaraibes.com/Epg/xmltv.xml',
parser({ content, channel, date }) {
let programs = []
const items = parseItems(content, channel, date)
items.forEach(item => {
programs.push({
title: item.title,
description: item.desc,
icon: item.icon,
category: item.category,
ratings: item.rating,
length: item.length,
start: item.start,
stop: item.stop
})
})
return programs
},
channels() {
return [
{
name: 'TMA',
site_id: 'TMA.gp@SD',
lang: 'fr',
xmltv_id: 'TMA.gp@SD'
}
]
}
}
function parseItems(content, channel, date) {
const { programs } = parser.parse(content)
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
}

View File

@@ -0,0 +1,75 @@
const { parser, url } = require('./epg.tmacaraibes.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('2026-05-22', 'YYYY-MM-DD').startOf('d')
const channel = { site_id: 'TMA.gp@SD' }
it('can generate valid url', () => {
expect(url).toBe('https://epg.tmacaraibes.com/Epg/xmltv.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(18)
expect(results[0]).toMatchObject({
title: [
{ lang: 'fr', value: 'PLAY LIST' },
{ lang: 'en', value: 'PLAY LIST' },
{ lang: 'es', value: 'PLAY LIST' },
{ lang: 'pt', value: 'PLAY LIST' }
],
description: [
{ lang: 'fr', value: 'Sélection des meilleurs clips africains et caribéens.' },
{ lang: 'en', value: 'Selection of the best African and Caribbean music videos.' },
{ lang: 'es', value: 'Selección de los mejores videoclips africanos y caribeños.' },
{ lang: 'pt', value: 'Seleção dos melhores videoclipes africanos e caribenhos.' }
],
category: [{ value: 'music' }],
length: [{ units: 'minutes', value: '180' }],
icon: [{ src: 'http://www.tmacaraibes.com/images/playlist/playlist-003.jpg' }],
ratings: [
{ system: 'CSA', value: 'Tout public' },
{ system: 'VCHIP', value: 'TV-G' }
],
start: '2026-05-22T04:00:00.000Z',
stop: '2026-05-22T07:00:00.000Z'
})
expect(results[17]).toMatchObject({
title: [
{ lang: 'fr', value: 'GLOBAL' },
{ lang: 'en', value: 'GLOBAL' },
{ lang: 'es', value: 'GLOBAL' },
{ lang: 'pt', value: 'GLOBAL' }
],
description: [
{ lang: 'fr', value: 'Toutes les musiques africaines et caribéennes.' },
{ lang: 'en', value: 'All African and Caribbean music.' },
{ lang: 'es', value: 'Toda la música africana y caribeña.' },
{ lang: 'pt', value: 'Todas as músicas africanas e caribenhas.' }
],
category: [{ value: 'music' }],
length: [{ units: 'minutes', value: '291' }],
icon: [{ src: 'http://www.tmacaraibes.com/images/global/global-001.jpg' }],
ratings: [
{ system: 'CSA', value: 'Tout public' },
{ system: 'VCHIP', value: 'TV-G' }
],
start: '2026-05-22T23:09:00.000Z',
stop: '2026-05-23T04:00:00.000Z'
})
})
it('can handle empty guide', () => {
const results = parser({ content: '' })
expect(results).toMatchObject([])
})

View File

@@ -0,0 +1,21 @@
# epg.tmacaraibes.com
http://epg.tmacaraibes.com/Epg/xmltv.xml
### Download the guide
```sh
npm run grab --- --sites=epg.tmacaraibes.com
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/epg.tmacaraibes.com/epg.tmacaraibes.com.config.js --output=./sites/epg.tmacaraibes.com/epg.tmacaraibes.com.channels.xml
```
### Test
```sh
npm test --- epg.tmacaraibes.com
```