mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-04 10:54:42 +08:00
iptv导入json时合并而非覆盖
This commit is contained in:
@@ -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()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user