Update maxtv.hrvatskitelekom.hr.config.js

This commit is contained in:
Aleksandr Statciuk 2021-11-17 00:19:41 +03:00
parent 4cbbbdfc69
commit 59c9e2a425

View file

@ -7,37 +7,43 @@ module.exports = {
data: function ({ channel, date }) { data: function ({ channel, date }) {
return { return {
channelList: [channel.site_id], channelList: [channel.site_id],
startDate: date.startOf('d').unix(), startDate: date.unix(),
endDate: date.endOf('d').unix() endDate: date.add(1, 'd').unix()
} }
} }
}, },
url: function ({ date, channel }) { url: 'https://player.maxtvtogo.tportal.hr:8082/OTT4Proxy/proxy/epg/shows',
return `https://player.maxtvtogo.tportal.hr:8082/OTT4Proxy/proxy/epg/shows` logo: function ({ content, channel }) {
}, const data = parseContent(content, channel)
logo: function ({ content }) {
const json = JSON.parse(content)
return json.data ? json.data[0].logo : null
},
parser: function ({ content }) {
const programs = []
const json = JSON.parse(content)
if (!json.data) return programs
const items = json.data[0].shows return data ? data.logo : null
},
parser: function ({ content, channel }) {
const programs = []
const items = parseItems(content, channel)
items.forEach(item => { items.forEach(item => {
if (item.title && item.startTime && item.endTime) { if (item.showId === -1) return
const start = dayjs.unix(item.startTime)
const stop = dayjs.unix(item.endTime)
programs.push({ programs.push({
title: item.title, title: item.title,
category: item.category, category: item.category,
start: start.toString(), start: dayjs.unix(item.startTime),
stop: stop.toString() stop: dayjs.unix(item.endTime)
}) })
}
}) })
return programs return programs
} }
} }
function parseContent(content, channel) {
const json = JSON.parse(content)
if (!Array.isArray(json.data)) return null
return json.data.find(i => i.channelId == channel.site_id)
}
function parseItems(content, channel) {
const data = parseContent(content, channel)
return data && Array.isArray(data.shows) ? data.shows : []
}