From d4530eef89cde247fd8d05387776232b6f71a2fd Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:52:13 +0800 Subject: [PATCH] =?UTF-8?q?iptv=E5=AF=BC=E5=85=A5json=E6=97=B6=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=80=8C=E9=9D=9E=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/IPTV.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/IPTV.vue b/src/components/IPTV.vue index 892a6d3..4e698c4 100644 --- a/src/components/IPTV.vue +++ b/src/components/IPTV.vue @@ -373,8 +373,17 @@ export default { }) } else { // Import Json file - var str = fs.readFileSync(file) - this.channelList = JSON.parse(str) + const importedList = JSON.parse(fs.readFileSync(file)) + importedList.forEach(ele => { + const commonEle = this.channelList.find(e => e.name === ele.name) + if (commonEle) { + const urls = commonEle.channels.map(c => c.url) + const channels = ele.channels.filter(e => !urls.includes(e.url)) + commonEle.channels.concat(channels) + } else { + this.channelList.push(ele) + } + }) this.updateDatabase() } })