mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 17:10:07 -04:00
Update programtv.onet.pl.config.js
This commit is contained in:
parent
9e928c1b87
commit
cc6d5d782d
1 changed files with 5 additions and 7 deletions
|
@ -9,14 +9,15 @@ dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
let PM = false
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
lang: 'pl',
|
lang: 'pl',
|
||||||
|
days: 3,
|
||||||
site: 'programtv.onet.pl',
|
site: 'programtv.onet.pl',
|
||||||
channels: 'programtv.onet.pl.channels.xml',
|
channels: 'programtv.onet.pl.channels.xml',
|
||||||
output: '.gh-pages/guides/programtv.onet.pl.guide.xml',
|
output: '.gh-pages/guides/programtv.onet.pl.guide.xml',
|
||||||
url: function ({ date, channel }) {
|
url: function ({ date, channel }) {
|
||||||
const day = dayjs().diff(date, 'd')
|
const today = dayjs().utc().startOf('d')
|
||||||
|
const day = date.diff(today, 'd')
|
||||||
return `https://programtv.onet.pl/program-tv/${channel.site_id}?dzien=${day}`
|
return `https://programtv.onet.pl/program-tv/${channel.site_id}?dzien=${day}`
|
||||||
},
|
},
|
||||||
logo: function ({ content }) {
|
logo: function ({ content }) {
|
||||||
|
@ -26,6 +27,7 @@ module.exports = {
|
||||||
return img ? 'https:' + img.src : null
|
return img ? 'https:' + img.src : null
|
||||||
},
|
},
|
||||||
parser: function ({ content, date }) {
|
parser: function ({ content, date }) {
|
||||||
|
let PM = false
|
||||||
const programs = []
|
const programs = []
|
||||||
const items = parseItems(content)
|
const items = parseItems(content)
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
|
@ -35,7 +37,7 @@ module.exports = {
|
||||||
let start = parseStart(item, date)
|
let start = parseStart(item, date)
|
||||||
if (start.hour() > 11) PM = true
|
if (start.hour() > 11) PM = true
|
||||||
if (start.hour() < 12 && PM) start = start.add(1, 'd')
|
if (start.hour() < 12 && PM) start = start.add(1, 'd')
|
||||||
const stop = parseStop(item, date)
|
const stop = start.add(1, 'h')
|
||||||
if (programs.length) {
|
if (programs.length) {
|
||||||
programs[programs.length - 1].stop = start
|
programs[programs.length - 1].stop = start
|
||||||
}
|
}
|
||||||
|
@ -53,10 +55,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStop(item, date) {
|
|
||||||
return date.add(1, 'd').hour(3).startOf('h')
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseStart(item, date) {
|
function parseStart(item, date) {
|
||||||
let time = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent
|
let time = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent
|
||||||
time = `${date.format('MM/DD/YYYY')} ${time}`
|
time = `${date.format('MM/DD/YYYY')} ${time}`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue