mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 10:00:05 -04:00
Rename to id.js
This commit is contained in:
parent
09c4947ac6
commit
442916d130
3 changed files with 6 additions and 6 deletions
23
scripts/core/id.js
Normal file
23
scripts/core/id.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const file = require('./file')
|
||||
const parser = require('./parser')
|
||||
const transliteration = require('transliteration')
|
||||
|
||||
const id = {}
|
||||
|
||||
id.generate = function (title, filepath) {
|
||||
const name = parser.parseChannelName(title)
|
||||
const code = parser.parseCountryCode(filepath)
|
||||
|
||||
if (name && code) {
|
||||
const slug = transliteration
|
||||
.transliterate(name)
|
||||
.replace(/\+/gi, 'Plus')
|
||||
.replace(/[^a-z\d]+/gi, '')
|
||||
|
||||
return `${slug}.${code.toLowerCase()}`
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = id
|
Loading…
Add table
Add a link
Reference in a new issue