mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update tv.lv.config.js
This commit is contained in:
parent
149627b09d
commit
8cc57354c7
1 changed files with 30 additions and 17 deletions
|
@ -2,6 +2,7 @@ const dayjs = require('dayjs')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'tv.lv',
|
site: 'tv.lv',
|
||||||
|
lang: 'lv',
|
||||||
url: function ({ date, channel }) {
|
url: function ({ date, channel }) {
|
||||||
return `https://www.tv.lv/programme/listing/none/${date.format(
|
return `https://www.tv.lv/programme/listing/none/${date.format(
|
||||||
'DD-MM-YYYY'
|
'DD-MM-YYYY'
|
||||||
|
@ -9,31 +10,43 @@ module.exports = {
|
||||||
},
|
},
|
||||||
logo: function ({ content }) {
|
logo: function ({ content }) {
|
||||||
const data = JSON.parse(content)
|
const data = JSON.parse(content)
|
||||||
const logo = data.schedule.programme.length ? data.schedule.programme[0].channel.logo_64 : null
|
const logo =
|
||||||
|
data.schedule.programme && data.schedule.programme.length
|
||||||
|
? data.schedule.programme[0].channel.logo_64
|
||||||
|
: null
|
||||||
|
|
||||||
return logo ? `https://cdn.tvstart.com/img/channel/${logo}` : null
|
return logo ? `https://cdn.tvstart.com/img/channel/${logo}` : null
|
||||||
},
|
},
|
||||||
parser: function ({ content }) {
|
parser: function ({ content }) {
|
||||||
const programs = []
|
const programs = []
|
||||||
const data = JSON.parse(content)
|
const items = parseItems(content)
|
||||||
const items = data.schedule.programme
|
|
||||||
if (!items.length) return programs
|
|
||||||
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item.title && item.start_unix && item.stop_unix) {
|
const start = parseStart(item)
|
||||||
const start = dayjs.unix(item.start_unix)
|
const stop = parseStop(item)
|
||||||
const stop = dayjs.unix(item.stop_unix)
|
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.title,
|
title: item.title,
|
||||||
description: item.description_long,
|
description: item.description_long,
|
||||||
category: item.categorystring,
|
category: item.categorystring,
|
||||||
icon: item.image,
|
icon: item.image,
|
||||||
start: start.toString(),
|
start,
|
||||||
stop: stop.toString()
|
stop
|
||||||
})
|
})
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
return item.start_unix ? dayjs.unix(item.start_unix) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
return item.stop_unix ? dayjs.unix(item.stop_unix) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content) {
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
|
||||||
|
return data.schedule.programme || []
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue