diff --git a/sites/vantagetv.ee/vantagetv.ee.config.js b/sites/vantagetv.ee/vantagetv.ee.config.js new file mode 100644 index 00000000..9cd489f4 --- /dev/null +++ b/sites/vantagetv.ee/vantagetv.ee.config.js @@ -0,0 +1,27 @@ +const parser = require('epg-parser') + +module.exports = { + site: 'vantagetv.ee', + days: 2, + url: 'http://vantagetv.ee/epg.xml', + parser: function ({ content, channel, date }) { + let programs = [] + const items = parseItems(content, channel, date) + items.forEach(item => { + programs.push({ + title: item.title?.[0]?.value, + description: item.desc?.[0]?.value, + start: item.start, + stop: item.stop + }) + }) + + return programs + } +} + +function parseItems(content, channel, date) { + const { programs } = parser.parse(content) + + return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day')) +}