mirror of
https://github.com/iptv-org/database.git
synced 2024-11-22 02:44:10 -05:00
Update validate.js
This commit is contained in:
parent
9f925606bd
commit
9a2cfb45f0
1 changed files with 21 additions and 1 deletions
|
@ -65,10 +65,11 @@ async function main() {
|
|||
fileErrors = fileErrors.concat(findDuplicatesById(rows))
|
||||
|
||||
for (const [i, row] of rows.entries()) {
|
||||
fileErrors = fileErrors.concat(await validateChannelBroadcastArea(row, i))
|
||||
fileErrors = fileErrors.concat(await validateChannelSubdivision(row, i))
|
||||
fileErrors = fileErrors.concat(await validateChannelCategories(row, i))
|
||||
fileErrors = fileErrors.concat(await validateChannelLanguages(row, i))
|
||||
fileErrors = fileErrors.concat(await validateChannelCountry(row, i))
|
||||
fileErrors = fileErrors.concat(await validateChannelSubdivision(row, i))
|
||||
}
|
||||
} else if (filename === 'blocklist') {
|
||||
for (const [i, row] of rows.entries()) {
|
||||
|
@ -160,6 +161,25 @@ async function validateChannelSubdivision(row, i) {
|
|||
return errors
|
||||
}
|
||||
|
||||
async function validateChannelBroadcastArea(row, i) {
|
||||
const errors = []
|
||||
row.broadcast_area.forEach(area => {
|
||||
const [type, code] = area.split('/')
|
||||
if (
|
||||
(type === 'r' && !db.regions[code]) ||
|
||||
(type === 'c' && !db.countries[code]) ||
|
||||
(type === 's' && !db.subdivisions[code])
|
||||
) {
|
||||
errors.push({
|
||||
line: i + 2,
|
||||
message: `"${row.id}" has the wrong broadcast_area "${area}"`
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
async function validateChannelLanguages(row, i) {
|
||||
const errors = []
|
||||
row.languages.forEach(language => {
|
||||
|
|
Loading…
Reference in a new issue