This commit is contained in:
Aleksandr Statciuk 2022-01-10 22:16:18 +03:00
parent f8981e478e
commit 043d738c95
14 changed files with 134 additions and 9 deletions

View file

@ -50,7 +50,9 @@ async function saveToDatabase() {
const chunks = split(_.shuffle(channels), options.maxClusters)
for (const [i, chunk] of chunks.entries()) {
for (const item of chunk) {
const countryCode = item.xmltv_id.split('.')[1]
item.cluster_id = i + 1
item.country = countryCode ? countryCode.toUpperCase() : null
await db.channels.insert(item)
}
}