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 { DateTime } = require('luxon')
|
||||||
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)
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'movistarplus.es',
|
site: 'movistarplus.es',
|
||||||
|
@ -18,25 +12,25 @@ module.exports = {
|
||||||
if (!items.length) return programs
|
if (!items.length) return programs
|
||||||
let guideDate = date
|
let guideDate = date
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
let startTime = dayjs.tz(
|
let startTime = DateTime.fromFormat(
|
||||||
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,
|
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,
|
||||||
'YYYY-MM-DD HH:mm',
|
'yyyy-MM-dd HH:mm',
|
||||||
'Europe/Madrid'
|
{ zone: 'Europe/Madrid' }
|
||||||
)
|
).toUTC()
|
||||||
let stopTime = dayjs.tz(
|
let stopTime = DateTime.fromFormat(
|
||||||
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`,
|
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`,
|
||||||
'YYYY-MM-DD HH:mm',
|
'yyyy-MM-dd HH:mm',
|
||||||
'Europe/Madrid'
|
{ zone: 'Europe/Madrid' }
|
||||||
)
|
).toUTC()
|
||||||
if (stopTime.isBefore(startTime)) {
|
if (stopTime < startTime) {
|
||||||
guideDate = guideDate.add(1, 'd')
|
guideDate = guideDate.add(1, 'd')
|
||||||
stopTime = stopTime.add(1, 'd')
|
stopTime = stopTime.plus({ days: 1 })
|
||||||
}
|
}
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.TITULO,
|
title: item.TITULO,
|
||||||
category: item.GENERO,
|
category: item.GENERO,
|
||||||
start: startTime.toJSON(),
|
start: startTime,
|
||||||
stop: stopTime.toJSON()
|
stop: stopTime
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return programs
|
return programs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue