mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update zap.co.ao.config.js
This commit is contained in:
parent
d0c475890c
commit
a1477bc67e
1 changed files with 10 additions and 9 deletions
|
@ -18,15 +18,17 @@ module.exports = {
|
||||||
|
|
||||||
return data ? data.image_uri : null
|
return data ? data.image_uri : null
|
||||||
},
|
},
|
||||||
parser: function ({ content, channel }) {
|
parser: function ({ content, channel, date }) {
|
||||||
let PM = false
|
|
||||||
const programs = []
|
const programs = []
|
||||||
const items = parseItems(content, channel)
|
const items = parseItems(content, channel)
|
||||||
if (!items.length) return programs
|
if (!items.length) return programs
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
let start = parseStart(item)
|
const prev = programs[programs.length - 1]
|
||||||
if (start.hour() > 11) PM = true
|
let start = parseStart(item, date)
|
||||||
if (start.hour() < 12 && PM) start = start.add(1, 'd')
|
if (prev && start.isBefore(prev.start)) {
|
||||||
|
start = start.add(1, 'd')
|
||||||
|
date = date.add(1, 'd')
|
||||||
|
}
|
||||||
const stop = start.add(item.duration, 's')
|
const stop = start.add(item.duration, 's')
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.name,
|
title: item.name,
|
||||||
|
@ -47,10 +49,9 @@ function parseItems(content, channel) {
|
||||||
return data ? data.epg : []
|
return data ? data.epg : []
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStart(item) {
|
function parseStart(item, date) {
|
||||||
const [date] = item.date.split('T')
|
|
||||||
const [hours, minutes] = item.start_time.split('h')
|
const [hours, minutes] = item.start_time.split('h')
|
||||||
const time = `${date} ${hours}:${minutes}`
|
const dateString = `${date.format('YYYY-MM-DD')} ${hours}:${minutes}`
|
||||||
|
|
||||||
return dayjs.tz(time, 'YYYY-MM-DD HH:mm', 'Africa/Luanda')
|
return dayjs.tz(dateString, 'YYYY-MM-DD HH:mm', 'Africa/Luanda')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue