mirror of
https://github.com/iptv-org/database.git
synced 2024-12-22 16:00:24 -05:00
Update validate.js
This commit is contained in:
parent
9a2cfb45f0
commit
a8621f852d
1 changed files with 16 additions and 0 deletions
|
@ -75,6 +75,10 @@ async function main() {
|
|||
for (const [i, row] of rows.entries()) {
|
||||
fileErrors = fileErrors.concat(await validateChannelId(row, i))
|
||||
}
|
||||
} else if (filename === 'countries') {
|
||||
for (const [i, row] of rows.entries()) {
|
||||
fileErrors = fileErrors.concat(await validateCountryLanguage(row, i))
|
||||
}
|
||||
}
|
||||
|
||||
const schema = Joi.object(schemes[filename])
|
||||
|
@ -206,6 +210,18 @@ async function validateChannelId(row, i) {
|
|||
return errors
|
||||
}
|
||||
|
||||
async function validateCountryLanguage(row, i) {
|
||||
const errors = []
|
||||
if (!db.languages[row.lang]) {
|
||||
errors.push({
|
||||
line: i + 2,
|
||||
message: `"${row.code}" has the wrong language "${row.lang}"`
|
||||
})
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
function handleError(message) {
|
||||
logger.error(chalk.red(`\n${message}`))
|
||||
process.exit(1)
|
||||
|
|
Loading…
Reference in a new issue