From 11cc75fa2ad0a7756d058366766f9e6a5c41c413 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 17 Sep 2021 14:24:50 +0300 Subject: [PATCH] Update db.js --- scripts/helpers/db.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/helpers/db.js b/scripts/helpers/db.js index 20c8ff7f1..0545a6c73 100644 --- a/scripts/helpers/db.js +++ b/scripts/helpers/db.js @@ -11,11 +11,10 @@ db.load = async function () { const codes = await epg.codes.load() for (const file of files) { const playlist = await parser.parsePlaylist(file) - let guides = [] for (const channel of playlist.channels) { const code = codes.find(ch => ch['tvg_id'] === channel.tvg.id) - if (code && Array.isArray(code.guides)) { - guides = [...guides, ...code.guides] + if (code && Array.isArray(code.guides) && code.guides.length) { + channel.tvg.url = code.guides[0] } db.channels.add(channel) @@ -33,8 +32,6 @@ db.load = async function () { } } - if (guides.length) playlist.header.attrs['url-tvg'] = guides.join(',') - db.playlists.add(playlist) } }