From 5984a426db453a269944fbec116372ca7e7f4ff2 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 15 Oct 2021 01:00:22 +0300 Subject: [PATCH] Delete parser.js --- scripts/parser.js | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 scripts/parser.js diff --git a/scripts/parser.js b/scripts/parser.js deleted file mode 100644 index 0510842a..00000000 --- a/scripts/parser.js +++ /dev/null @@ -1,37 +0,0 @@ -const convert = require('xml-js') - -const parser = {} - -parser.parseChannels = function (xml) { - const result = convert.xml2js(xml) - const siteTag = result.elements.find(el => el.name === 'site') - const channelsTags = siteTag.elements.filter(el => el.name === 'channels') - - const output = { - site: siteTag.attributes.site, - groups: [] - } - - channelsTags.forEach(channelsTag => { - const channels = channelsTag.elements - .filter(el => el.name === 'channel') - .map(el => { - const channel = el.attributes - if (!el.elements) throw new Error(`Channel '${channel.xmltv_id}' has no valid name`) - channel.name = el.elements.find(el => el.type === 'text').text - channel.country = channelsTag.attributes.country - channel.site = siteTag.attributes.site - - return channel - }) - - output.groups.push({ - country: channelsTag.attributes.country, - channels - }) - }) - - return output -} - -module.exports = parser