mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 10:30:03 -04:00
Create scripts/store/setters
This commit is contained in:
parent
21b8ce8731
commit
42d8a670d2
13 changed files with 156 additions and 0 deletions
13
scripts/store/setters/src_country.js
Normal file
13
scripts/store/setters/src_country.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
const { file } = require('../../core')
|
||||
const countries = require('../../data/countries')
|
||||
|
||||
module.exports = function ({ filepath }) {
|
||||
if (filepath) {
|
||||
const basename = file.basename(filepath)
|
||||
const [_, code] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null]
|
||||
|
||||
return code ? countries[code.toUpperCase()] : null
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue