Remove epg parser

This commit is contained in:
freearhey 2021-03-06 21:22:23 +03:00
parent b7b01ad92f
commit 80f3518d57
5 changed files with 0 additions and 132 deletions

View file

@ -11,7 +11,6 @@ program
.option('-d, --debug', 'Debug mode')
.option('-c, --country <country>', 'Comma-separated list of country codes', '')
.option('-e, --exclude <exclude>', 'Comma-separated list of country codes to be excluded', '')
.option('--epg', 'Turn on EPG parser')
.option('--resolution', 'Turn on resolution parser')
.option('--delay <delay>', 'Delay between parser requests', 0)
.option('--timeout <timeout>', 'Set timeout for each request', 5000)
@ -39,7 +38,6 @@ async function main() {
.then(filterChannels)
.then(removeDuplicates)
.then(detectResolution)
.then(updateFromEPG)
.then(savePlaylist)
.then(done)
}
@ -161,40 +159,6 @@ function parseResolution(string) {
: undefined
}
async function updateFromEPG(playlist) {
if (!config.epg) return playlist
const tvgUrl = playlist.header.attrs['x-tvg-url']
if (!tvgUrl) return playlist
console.info(` Adding data from '${tvgUrl}'...`)
return utils
.parseEPG(tvgUrl)
.then(epg => {
if (!epg) return playlist
playlist.channels.map(channel => {
if (!channel.tvg.id) return channel
const epgItem = epg.channels[channel.tvg.id]
if (!epgItem) return channel
if (!channel.tvg.name && epgItem.name.length) {
channel.tvg.name = epgItem.name[0].value
}
if (!channel.languages.length && epgItem.name.length && epgItem.name[0].lang) {
channel.languages = utils.parseLanguages(epgItem.name[0].lang)
}
if (!channel.logo && epgItem.icon.length) {
channel.logo = epgItem.icon[0]
}
})
return playlist
})
.catch(err => {
console.log(`Error: EPG could not be loaded`)
})
}
async function removeUnsortedDuplicates(playlist) {
console.info(` Looking for duplicates...`)
const urls = globalBuffer.map(i => i.url.replace(/(^\w+:|^)\/\//, ''))