epg-grabber/src/Channel.js

24 lines
373 B
JavaScript
Raw Normal View History

2022-06-16 14:07:56 +02:00
class Channel {
constructor(c) {
const data = {
2022-06-16 18:11:11 +02:00
id: c.id || c.xmltv_id,
2022-06-16 14:07:56 +02:00
name: c.name,
site: c.site || '',
2022-06-16 14:20:19 +02:00
site_id: c.site_id,
2022-06-16 14:07:56 +02:00
lang: c.lang || '',
logo: c.logo || '',
2022-06-16 18:11:11 +02:00
url: c.url || toURL(c.site)
2022-06-16 14:07:56 +02:00
}
for (let key in data) {
this[key] = data[key]
}
}
}
module.exports = Channel
2022-06-16 18:11:11 +02:00
function toURL(site) {
return site ? `https://${site}` : ''
}