mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Season / Episode
Validation of season / episode part 2
This commit is contained in:
parent
36d3f2b76c
commit
a0712fab35
3 changed files with 42 additions and 6 deletions
|
@ -18,8 +18,8 @@ module.exports = {
|
|||
title: item.eventTitle,
|
||||
description: item.eventSynopsis,
|
||||
category: parseCategory(item),
|
||||
season: item.content.seasonNumber || null,
|
||||
episode: item.content.episodeNumber || null,
|
||||
season: parseSeason(item),
|
||||
episode: parseEpisode(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item),
|
||||
url: parseURL(item),
|
||||
|
@ -57,3 +57,15 @@ function parseIcon(item) {
|
|||
|
||||
return cover && cover.img && cover.img.url ? `https://guidatv.sky.it${cover.img.url}` : null
|
||||
}
|
||||
|
||||
function parseSeason(item) {
|
||||
if (!item.content.seasonNumber) return null
|
||||
if (String(item.content.seasonNumber)).length > 2) return null
|
||||
return item.content.seasonNumber
|
||||
}
|
||||
|
||||
function parseEpisode(item) {
|
||||
if (!item.content.episodeNumber) return null
|
||||
if (String(item.content.episodeNumber).length > 3) return null
|
||||
return item.content.episodeNumber
|
||||
}
|
|
@ -67,8 +67,8 @@ module.exports = {
|
|||
actors: detail.actors,
|
||||
directors: detail.directors,
|
||||
producers: detail.producers,
|
||||
season: detail.seasonNumber,
|
||||
episode: detail.episodeNumber,
|
||||
season: parseSeason(detail),
|
||||
episode: parseEpisode(detail),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
|
@ -120,3 +120,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
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ module.exports = {
|
|||
programs.push({
|
||||
title: item.name || item.program.name,
|
||||
description: item.description,
|
||||
season: item.season || null,
|
||||
episode: item.episode || null,
|
||||
season: parseSeason(item) ,
|
||||
episode: parseEpisode(item),
|
||||
sub_title : item['episode_title'] || null,
|
||||
url : parseURL(item),
|
||||
start,
|
||||
|
@ -64,3 +64,15 @@ function parseURL(item) {
|
|||
}
|
||||
return url
|
||||
}
|
||||
|
||||
function parseSeason(item) {
|
||||
if (!item.season) return null
|
||||
if (String(item.season).length > 2) return null
|
||||
return item.season
|
||||
}
|
||||
|
||||
function parseEpisode(item) {
|
||||
if (!item.episode) return null
|
||||
if (String(item.episode).length > 3) return null
|
||||
return item.episode
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue