Created channel.setLanguage() method

This commit is contained in:
freearhey 2020-05-04 16:31:58 +03:00
parent ca06ca5f65
commit 595b4e044c
1 changed files with 24 additions and 21 deletions

View File

@ -278,7 +278,30 @@ class Channel {
}
parseData(data) {
const language = data.tvg.language
this.logo = data.tvg.logo
this.category = helper.filterGroup(data.group.title)
this.url = data.url
this.name = data.name.trim()
this.http = data.http
this.tvg = data.tvg
this.country = {
code: null,
name: null
}
this.setLanguage(data.tvg.language)
}
get ['language.name']() {
return this.language[0] ? this.language[0].name : null
}
get ['country.name']() {
return this.country.name || null
}
setLanguage(lang) {
this.language = lang
.split(';')
.map(name => {
const code = name ? helper.getISO6391Code(name) : null
@ -290,26 +313,6 @@ class Channel {
}
})
.filter(l => l)
this.language = language
this.logo = data.tvg.logo
this.category = helper.filterGroup(data.group.title)
this.url = data.url
this.name = data.name.trim()
this.http = data.http
this.tvg = data.tvg
this.country = {
code: null,
name: null
}
}
get ['language.name']() {
return this.language[0] ? this.language[0].name : null
}
get ['country.name']() {
return this.country.name || null
}
toString() {