mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update andorradifusio.ad.config.js
This commit is contained in:
parent
2be4443eb5
commit
7288eb1ab6
1 changed files with 11 additions and 11 deletions
|
@ -15,21 +15,21 @@ module.exports = {
|
|||
return `https://www.andorradifusio.ad/programacio/${channel.site_id}`
|
||||
},
|
||||
parser({ content, date }) {
|
||||
let PM = false
|
||||
const programs = []
|
||||
const items = parseItems(content, date)
|
||||
items.forEach(item => {
|
||||
const title = item.title
|
||||
const prev = programs[programs.length - 1]
|
||||
let start = parseStart(item, date)
|
||||
if (start.hour() > 11) PM = true
|
||||
if (start.hour() < 12 && PM) start = start.add(1, 'd')
|
||||
const stop = start.add(1, 'h')
|
||||
if (programs.length) {
|
||||
programs[programs.length - 1].stop = start
|
||||
if (prev) {
|
||||
if (start.isBefore(prev.start)) {
|
||||
start = start.add(1, 'd')
|
||||
date = date.add(1, 'd')
|
||||
}
|
||||
prev.stop = start
|
||||
}
|
||||
|
||||
const stop = start.add(1, 'h')
|
||||
programs.push({
|
||||
title,
|
||||
title: item.title,
|
||||
start,
|
||||
stop
|
||||
})
|
||||
|
@ -40,9 +40,9 @@ module.exports = {
|
|||
}
|
||||
|
||||
function parseStart(item, date) {
|
||||
time = `${date.format('MM/DD/YYYY')} ${item.time}`
|
||||
const dateString = `${date.format('MM/DD/YYYY')} ${item.time}`
|
||||
|
||||
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Madrid')
|
||||
return dayjs.tz(dateString, 'MM/DD/YYYY HH:mm', 'Europe/Madrid')
|
||||
}
|
||||
|
||||
function parseItems(content, date) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue