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
|
@ -99,10 +99,14 @@ function parseCategory(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) {
|
||||
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',
|
||||
title: 'Live: NHL Hockey',
|
||||
description: 'The Boston Bruins make the trip to Xcel Energy Center for an NHL clash with the Minnesota Wild.',
|
||||
category: ['Sport', 'Ice Hockey'],
|
||||
season: '20120000',
|
||||
episode: '2022031605'
|
||||
category: ['Sport', 'Ice Hockey']
|
||||
},
|
||||
{
|
||||
start: '2022-03-17T02:30:00.000Z',
|
||||
stop: '2022-03-17T06:00:00.000Z',
|
||||
title: 'Challenge Cup Ice Hockey',
|
||||
description: 'Exclusive coverage from SSE Arena of the Premier Sports Challenge Final between Belfast Giants and Cardiff Devils.',
|
||||
category: ['Ice Hockey'],
|
||||
season: '79870000',
|
||||
episode: '2022031605'
|
||||
category: ['Ice Hockey']
|
||||
},
|
||||
{
|
||||
start: '2022-03-17T10:00:00.000Z',
|
||||
stop: '2022-03-17T12:00:00.000Z',
|
||||
title: 'NHL Hockey',
|
||||
description: 'The Calgary Flames play host to the New Jersey Devils in this NHL encounter from Scotiabank Saddledome.',
|
||||
category: ['Sport', 'Ice Hockey'],
|
||||
season: '102022',
|
||||
episode: '194'
|
||||
category: ['Sport', 'Ice Hockey']
|
||||
},
|
||||
{
|
||||
start: '2022-03-17T17:45:00.000Z',
|
||||
|
|
|
@ -63,8 +63,8 @@ module.exports = {
|
|||
description: detail.longDescription,
|
||||
category: detail.genres,
|
||||
actors: detail.actors,
|
||||
season: detail.seasonNumber,
|
||||
episode: detail.episodeNumber,
|
||||
season: parseSeason(detail),
|
||||
episode: parseEpisode(detail),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
|
@ -118,3 +118,15 @@ function parseItems(content, channel) {
|
|||
|
||||
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',
|
||||
'Saïda Maggé',
|
||||
'Winfried Baijens'
|
||||
],
|
||||
season: 6510000,
|
||||
episode: 144222201
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue