Update create-database.js

This commit is contained in:
Aleksandr Statciuk 2022-02-05 07:25:56 +03:00
parent fa4bad3dca
commit 46deb7f004
8 changed files with 34 additions and 27 deletions

View file

@ -28,4 +28,23 @@ parser.parseNumber = function (string) {
return parsed
}
parser.parseChannelName = function (string) {
return string
.trim()
.split(' ')
.map(s => s.trim())
.filter(s => {
return !/\[|\]/i.test(s) && !/\((\d+)P\)/i.test(s)
})
.join(' ')
}
parser.parseCountryCode = function (filepath) {
if (!filepath) return null
const basename = file.basename(filepath)
const [code] = basename.split('_') || [null]
return code
}
module.exports = parser