Created channel.setLanguage() method

pull/1331/head
freearhey 5 years ago
parent ca06ca5f65
commit 595b4e044c

@ -278,20 +278,6 @@ class Channel {
}
parseData(data) {
const language = data.tvg.language
.split(';')
.map(name => {
const code = name ? helper.getISO6391Code(name) : null
if (!code) return null
return {
code,
name
}
})
.filter(l => l)
this.language = language
this.logo = data.tvg.logo
this.category = helper.filterGroup(data.group.title)
this.url = data.url
@ -302,6 +288,8 @@ class Channel {
code: null,
name: null
}
this.setLanguage(data.tvg.language)
}
get ['language.name']() {
@ -312,6 +300,21 @@ class Channel {
return this.country.name || null
}
setLanguage(lang) {
this.language = lang
.split(';')
.map(name => {
const code = name ? helper.getISO6391Code(name) : null
if (!code) return null
return {
code,
name
}
})
.filter(l => l)
}
toString() {
const country = this.country.code ? this.country.code.toUpperCase() : ''
const tvgUrl = (this.tvg.id || this.tvg.name) && this.tvg.url ? this.tvg.url : ''

Loading…
Cancel
Save