Added guide from tvtv.ca
This commit is contained in:
1641
sites/tvtv.ca.channels.xml
Executable file
1641
sites/tvtv.ca.channels.xml
Executable file
File diff suppressed because it is too large
Load Diff
34
sites/tvtv.ca.config.js
Normal file
34
sites/tvtv.ca.config.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
module.exports = {
|
||||
lang: 'en',
|
||||
site: 'tvtv.ca',
|
||||
channels: 'tvtv.ca.channels.xml',
|
||||
output: '.gh-pages/guides/tvtv.ca.guide.xml',
|
||||
url: function ({ date, channel }) {
|
||||
return `https://www.tvtv.ca/tvm/t/tv/v4/stations/${
|
||||
channel.site_id
|
||||
}/listings?start=${date.format()}&end=${date.add(1, 'd').format()}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
let programs = []
|
||||
const items = JSON.parse(content)
|
||||
if (!items.length) return programs
|
||||
items.forEach(item => {
|
||||
const start = dayjs.utc(item.listDateTime)
|
||||
const stop = start.add(item.duration, 'm')
|
||||
programs.push({
|
||||
title: item.showName,
|
||||
description: item.description,
|
||||
category: item.showType,
|
||||
start: start.toString(),
|
||||
stop: stop.toString()
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user