mirror of
https://github.com/iptv-org/database.git
synced 2024-11-22 02:44:10 -05:00
Update update.js
This commit is contained in:
parent
750749cb3c
commit
74e2209975
1 changed files with 22 additions and 1 deletions
|
@ -21,6 +21,7 @@ async function main() {
|
||||||
const filepath = `${DATA_DIR}/channels.csv`
|
const filepath = `${DATA_DIR}/channels.csv`
|
||||||
channels = await csv.fromFile(filepath)
|
channels = await csv.fromFile(filepath)
|
||||||
|
|
||||||
|
await removeChannels()
|
||||||
await editChannels()
|
await editChannels()
|
||||||
await addChannels()
|
await addChannels()
|
||||||
|
|
||||||
|
@ -36,6 +37,26 @@ async function main() {
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
async function removeChannels() {
|
||||||
|
const issues = await fetchIssues('channels:remove,approved')
|
||||||
|
issues.map(parseIssue).forEach(({ issue, channel }) => {
|
||||||
|
if (!channel) {
|
||||||
|
updateIssue(issue, { labels: ['channels:remove', 'rejected:invalid'] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = _.findIndex(channels, { id: channel.id })
|
||||||
|
if (index < 0) {
|
||||||
|
updateIssue(issue, { labels: ['channels:remove', 'rejected:wrong_id'] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
channels.splice(index, 1)
|
||||||
|
|
||||||
|
processedIssues.push(issue)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async function editChannels() {
|
async function editChannels() {
|
||||||
const issues = await fetchIssues('channels:edit,approved')
|
const issues = await fetchIssues('channels:edit,approved')
|
||||||
issues.map(parseIssue).forEach(({ issue, channel }) => {
|
issues.map(parseIssue).forEach(({ issue, channel }) => {
|
||||||
|
@ -46,7 +67,7 @@ async function editChannels() {
|
||||||
|
|
||||||
const index = _.findIndex(channels, { id: channel.id })
|
const index = _.findIndex(channels, { id: channel.id })
|
||||||
if (!index) {
|
if (!index) {
|
||||||
updateIssue(issue, { labels: ['channels:edit', 'rejected:invalid'] })
|
updateIssue(issue, { labels: ['channels:edit', 'rejected:wrong_id'] })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue