Return the old value of replace_by

This commit is contained in:
freearhey 2023-10-12 09:33:28 +03:00
parent 0fe039a9d6
commit 76fa5d6b46
2 changed files with 3 additions and 5 deletions

View file

@ -73,8 +73,8 @@
},
{
name: 'replaced_by',
type: 'channel',
value: data._replaced_by ? data._replaced_by.name : null
type: 'string',
value: data.replaced_by
},
{ name: 'website', type: 'external_link', value: data.website }
].filter(f => (Array.isArray(f.value) ? f.value.length : f.value))

View file

@ -33,7 +33,7 @@ export async function fetchChannels() {
countries.set(api.countries)
let _channels = Object.values(api.channels).map(c => transformChannel(c, api))
let _channels = api.channels.map(c => transformChannel(c, api))
channels.set(_channels)
filteredChannels.set(_channels)
@ -134,7 +134,6 @@ async function loadAPI() {
api.channels = await fetch('https://iptv-org.github.io/api/channels.json')
.then(r => r.json())
.then(data => (data.length ? data : []))
.then(data => _.keyBy(data, channel => channel.id.toLowerCase()))
.catch(err => {
console.error(err)
return []
@ -163,7 +162,6 @@ export function transformChannel(channel, data) {
channel.is_closed = !!channel.closed || !!channel.replaced_by
channel.is_blocked = !!data.blocklist[channel.id]
channel.streams = channel._streams.length
channel._replaced_by = channel.replaced_by ? data.channels[channel.replaced_by.toLowerCase()] : {}
return channel
}