diff --git a/scripts/db.js b/scripts/db.js index e4072cbd09..75cf792ff7 100644 --- a/scripts/db.js +++ b/scripts/db.js @@ -32,6 +32,7 @@ db.load = function () { db.channels = { list: [], filter: null, + duplicates: true, add(channel) { this.list.push(channel) }, @@ -68,13 +69,30 @@ db.channels = { break } } else { - output = this.all() + output = this.list } + if (!this.duplicates) { + const buffer = [] + output = output.filter(channel => { + const info = channel.getInfo() + if (buffer.includes(info)) return false + buffer.push(info) + + return true + }) + } + + this.duplicates = true this.filter = null return output }, + removeDuplicates() { + this.duplicates = false + + return this + }, all() { return this.list },