Update format.js

Ignore protocol during duplicates search for unsorted channels too
This commit is contained in:
freearhey 2021-03-01 01:21:13 +03:00
parent 0ca88e68f8
commit 4c457f98fa
1 changed files with 2 additions and 2 deletions

View File

@ -184,8 +184,8 @@ async function updateFromEPG(playlist) {
async function removeUnsortedDuplicates(playlist) { async function removeUnsortedDuplicates(playlist) {
console.info(` Looking for duplicates...`) console.info(` Looking for duplicates...`)
const urls = globalBuffer.map(i => i.url) const urls = globalBuffer.map(i => i.url.replace(/(^\w+:|^)\/\//, ''))
const channels = playlist.channels.filter(i => !urls.includes(i.url)) const channels = playlist.channels.filter(i => !urls.includes(i.url.replace(/(^\w+:|^)\/\//, '')))
if (channels.length === playlist.channels.length) return playlist if (channels.length === playlist.channels.length) return playlist
playlist.channels = channels playlist.channels = channels