mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update movistarplus.es.config.js
This commit is contained in:
parent
ddfae7b3d3
commit
b2b3a49509
1 changed files with 13 additions and 19 deletions
|
@ -1,10 +1,4 @@
|
|||
const dayjs = require('dayjs')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
var customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(customParseFormat)
|
||||
const { DateTime } = require('luxon')
|
||||
|
||||
module.exports = {
|
||||
site: 'movistarplus.es',
|
||||
|
@ -18,25 +12,25 @@ module.exports = {
|
|||
if (!items.length) return programs
|
||||
let guideDate = date
|
||||
items.forEach(item => {
|
||||
let startTime = dayjs.tz(
|
||||
let startTime = DateTime.fromFormat(
|
||||
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,
|
||||
'YYYY-MM-DD HH:mm',
|
||||
'Europe/Madrid'
|
||||
)
|
||||
let stopTime = dayjs.tz(
|
||||
'yyyy-MM-dd HH:mm',
|
||||
{ zone: 'Europe/Madrid' }
|
||||
).toUTC()
|
||||
let stopTime = DateTime.fromFormat(
|
||||
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`,
|
||||
'YYYY-MM-DD HH:mm',
|
||||
'Europe/Madrid'
|
||||
)
|
||||
if (stopTime.isBefore(startTime)) {
|
||||
'yyyy-MM-dd HH:mm',
|
||||
{ zone: 'Europe/Madrid' }
|
||||
).toUTC()
|
||||
if (stopTime < startTime) {
|
||||
guideDate = guideDate.add(1, 'd')
|
||||
stopTime = stopTime.add(1, 'd')
|
||||
stopTime = stopTime.plus({ days: 1 })
|
||||
}
|
||||
programs.push({
|
||||
title: item.TITULO,
|
||||
category: item.GENERO,
|
||||
start: startTime.toJSON(),
|
||||
stop: stopTime.toJSON()
|
||||
start: startTime,
|
||||
stop: stopTime
|
||||
})
|
||||
})
|
||||
return programs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue