Update format.js

This commit is contained in:
Aleksandr Statciuk 2021-10-23 06:40:30 +03:00
parent a4c3ebbcdd
commit 403c6ae10d
1 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ async function updatePlaylist(playlist) {
const curr = i + 1 const curr = i + 1
updateTvgName(channel) updateTvgName(channel)
updateTvgId(channel, playlist) updateTvgId(channel, playlist)
updateTvgCountry(channel, playlist) updateTvgCountry(channel)
normalizeUrl(channel) normalizeUrl(channel)
const data = channels[channel.tvg.id] const data = channels[channel.tvg.id]
@ -217,9 +217,9 @@ function updateTvgId(channel, playlist) {
} }
} }
function updateTvgCountry(channel, playlist) { function updateTvgCountry(channel) {
const code = playlist.country.code if (!channel.countries.length && channel.tvg.id) {
if (!channel.countries.length) { const code = channel.tvg.id.split('.')[1] || null
const name = utils.code2name(code) const name = utils.code2name(code)
channel.countries = name ? [{ code, name }] : [] channel.countries = name ? [{ code, name }] : []
channel.tvg.country = channel.countries.map(c => c.code.toUpperCase()).join(';') channel.tvg.country = channel.countries.map(c => c.code.toUpperCase()).join(';')