mirror of
https://github.com/iptv-org/database.git
synced 2025-01-22 03:01:01 -05:00
Update update.ts
This commit is contained in:
parent
106acefe87
commit
418d428b6f
1 changed files with 22 additions and 0 deletions
|
@ -85,6 +85,8 @@ async function editChannels({ loader, idCreator }: { loader: IssueLoader; idCrea
|
||||||
const country = data.getString('country') || found.country
|
const country = data.getString('country') || found.country
|
||||||
if (name && country) {
|
if (name && country) {
|
||||||
channelId = idCreator.create(name, country)
|
channelId = idCreator.create(name, country)
|
||||||
|
updateBlocklistId(found.id, channelId)
|
||||||
|
updateChannelReplacedBy(found.id, channelId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,3 +198,23 @@ async function blockChannels({ loader }: { loader: IssueLoader }) {
|
||||||
processedIssues.push(issue)
|
processedIssues.push(issue)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateBlocklistId(oldId: string, newId: string) {
|
||||||
|
const filtered: Collection = blocklist.filter((blocked: Blocked) => blocked.channel === oldId)
|
||||||
|
if (filtered.isEmpty()) return
|
||||||
|
|
||||||
|
filtered.forEach(item => {
|
||||||
|
item.channel = newId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateChannelReplacedBy(channelId: string, newReplacedBy: string) {
|
||||||
|
const filtered: Collection = channels.filter(
|
||||||
|
(channel: Channel) => channel.replaced_by === channelId
|
||||||
|
)
|
||||||
|
if (filtered.isEmpty()) return
|
||||||
|
|
||||||
|
filtered.forEach(item => {
|
||||||
|
item.replaced_by = newReplacedBy
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue