diff --git a/helpers/format.js b/helpers/format.js index e410fc3a84..dab954e39a 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) {