From 8b4ae200b021ab2bec3d92d83ba0d2378bd9d686 Mon Sep 17 00:00:00 2001 From: freearhey Date: Wed, 23 Oct 2019 13:15:46 +0300 Subject: [PATCH] wip --- helpers/format.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/helpers/format.js b/helpers/format.js index e410fc3a8..dab954e39 100644 --- a/helpers/format.js +++ b/helpers/format.js @@ -77,6 +77,23 @@ async function main() { buffer[epgUrl] = epg } + if(buffer[epgUrl]) { + console.log('Add missing tvg-id from EPG by channel title...') + for(let channel of channels) { + for(let channelId in buffer[epgUrl].channels) { + let c = buffer[epgUrl].channels[channelId] + for(let epgName of c.names) { + let regexp = new RegExp(`^${epgName}`, 'i') + if(regexp.test(channel.title)) { + if(!channel.id) { + channel.id = c.id + } + } + } + } + } + } + if(buffer[epgUrl]) { console.log(`Fills in missing channel's data...`) for(let channel of channels) {