Create scripts/store/getters

This commit is contained in:
Aleksandr Statciuk 2021-12-12 07:11:50 +03:00
parent 0e21288935
commit 21b8ce8731
8 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,12 @@
module.exports = function () {
if (this.group_title) return this.group_title
if (Array.isArray(this.categories)) {
return this.categories
.map(i => i.name)
.sort()
.join(';')
}
return ''
}

View File

@ -0,0 +1,7 @@
exports.group_title = require('./group_title')
exports.title = require('./title')
exports.tvg_country = require('./tvg_country')
exports.tvg_id = require('./tvg_id')
exports.tvg_language = require('./tvg_language')
exports.tvg_logo = require('./tvg_logo')
exports.tvg_url = require('./tvg_url')

View File

@ -0,0 +1,13 @@
module.exports = function () {
let title = this.name
if (this.resolution.height) {
title += ` (${this.resolution.height}p)`
}
if (this.status.label) {
title += ` [${this.status.label}]`
}
return title
}

View File

@ -0,0 +1,5 @@
module.exports = function () {
if (this.tvg_country) return this.tvg_country
return Array.isArray(this.countries) ? this.countries.map(i => i.code).join(';') : ''
}

View File

@ -0,0 +1,3 @@
module.exports = function () {
return this.id || ''
}

View File

@ -0,0 +1,3 @@
module.exports = function () {
return Array.isArray(this.languages) ? this.languages.map(i => i.name).join(';') : ''
}

View File

@ -0,0 +1,3 @@
module.exports = function () {
return this.logo || ''
}

View File

@ -0,0 +1,3 @@
module.exports = function () {
return this.guides.length ? this.guides[0] : ''
}