mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
commit
f8dbc0376b
4 changed files with 29 additions and 21 deletions
|
@ -96,13 +96,17 @@ function parseCategory(detail) {
|
||||||
categories.push(category.title)
|
categories.push(category.title)
|
||||||
});
|
});
|
||||||
return categories
|
return categories
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseSeason(detail) {
|
function parseSeason(detail) {
|
||||||
return detail.program.seriesNumber || null
|
if (!detail.program.seriesNumber) return null
|
||||||
}
|
if (String(detail.program.seriesNumber).length > 2) return null
|
||||||
|
return detail.program.seriesNumber
|
||||||
|
}
|
||||||
|
|
||||||
function parseEpisode(detail) {
|
function parseEpisode(detail) {
|
||||||
return detail.program.seriesEpisodeNumber || null
|
if (!detail.program.seriesEpisodeNumber) return null
|
||||||
}
|
if (String(detail.program.seriesEpisodeNumber).length > 3) return null
|
||||||
|
return detail.program.seriesEpisodeNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,27 +88,21 @@ it('can parse response', done => {
|
||||||
stop: '2022-03-17T02:30:00.000Z',
|
stop: '2022-03-17T02:30:00.000Z',
|
||||||
title: 'Live: NHL Hockey',
|
title: 'Live: NHL Hockey',
|
||||||
description: 'The Boston Bruins make the trip to Xcel Energy Center for an NHL clash with the Minnesota Wild.',
|
description: 'The Boston Bruins make the trip to Xcel Energy Center for an NHL clash with the Minnesota Wild.',
|
||||||
category: ['Sport', 'Ice Hockey'],
|
category: ['Sport', 'Ice Hockey']
|
||||||
season: '20120000',
|
|
||||||
episode: '2022031605'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: '2022-03-17T02:30:00.000Z',
|
start: '2022-03-17T02:30:00.000Z',
|
||||||
stop: '2022-03-17T06:00:00.000Z',
|
stop: '2022-03-17T06:00:00.000Z',
|
||||||
title: 'Challenge Cup Ice Hockey',
|
title: 'Challenge Cup Ice Hockey',
|
||||||
description: 'Exclusive coverage from SSE Arena of the Premier Sports Challenge Final between Belfast Giants and Cardiff Devils.',
|
description: 'Exclusive coverage from SSE Arena of the Premier Sports Challenge Final between Belfast Giants and Cardiff Devils.',
|
||||||
category: ['Ice Hockey'],
|
category: ['Ice Hockey']
|
||||||
season: '79870000',
|
|
||||||
episode: '2022031605'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: '2022-03-17T10:00:00.000Z',
|
start: '2022-03-17T10:00:00.000Z',
|
||||||
stop: '2022-03-17T12:00:00.000Z',
|
stop: '2022-03-17T12:00:00.000Z',
|
||||||
title: 'NHL Hockey',
|
title: 'NHL Hockey',
|
||||||
description: 'The Calgary Flames play host to the New Jersey Devils in this NHL encounter from Scotiabank Saddledome.',
|
description: 'The Calgary Flames play host to the New Jersey Devils in this NHL encounter from Scotiabank Saddledome.',
|
||||||
category: ['Sport', 'Ice Hockey'],
|
category: ['Sport', 'Ice Hockey']
|
||||||
season: '102022',
|
|
||||||
episode: '194'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: '2022-03-17T17:45:00.000Z',
|
start: '2022-03-17T17:45:00.000Z',
|
||||||
|
|
|
@ -63,8 +63,8 @@ module.exports = {
|
||||||
description: detail.longDescription,
|
description: detail.longDescription,
|
||||||
category: detail.genres,
|
category: detail.genres,
|
||||||
actors: detail.actors,
|
actors: detail.actors,
|
||||||
season: detail.seasonNumber,
|
season: parseSeason(detail),
|
||||||
episode: detail.episodeNumber,
|
episode: parseEpisode(detail),
|
||||||
start: parseStart(item),
|
start: parseStart(item),
|
||||||
stop: parseStop(item)
|
stop: parseStop(item)
|
||||||
})
|
})
|
||||||
|
@ -118,3 +118,15 @@ function parseItems(content, channel) {
|
||||||
|
|
||||||
return Array.isArray(channelData.events) ? channelData.events : []
|
return Array.isArray(channelData.events) ? channelData.events : []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseSeason(detail) {
|
||||||
|
if (!detail.seasonNumber) return null
|
||||||
|
if (String(detail.seasonNumber).length > 2) return null
|
||||||
|
return detail.seasonNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseEpisode(detail) {
|
||||||
|
if (!detail.episodeNumber) return null
|
||||||
|
if (String(detail.episodeNumber).length > 3) return null
|
||||||
|
return detail.episodeNumber
|
||||||
|
}
|
|
@ -87,9 +87,7 @@ it('can parse response', async () => {
|
||||||
'Jeroen Tjepkema',
|
'Jeroen Tjepkema',
|
||||||
'Saïda Maggé',
|
'Saïda Maggé',
|
||||||
'Winfried Baijens'
|
'Winfried Baijens'
|
||||||
],
|
]
|
||||||
season: 6510000,
|
|
||||||
episode: 144222201
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue