From 3b95579c735640faf23d0601faedfeac6d724728 Mon Sep 17 00:00:00 2001 From: freearhey Date: Sat, 24 Apr 2021 15:42:29 +0300 Subject: [PATCH] Update parser.js - renamed toJSON() to toObject() - created method getInfo() --- scripts/parser.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/parser.js b/scripts/parser.js index 5def3eacb..b410b732e 100644 --- a/scripts/parser.js +++ b/scripts/parser.js @@ -181,7 +181,7 @@ class Channel { return '' } - toString(short = false) { + getInfo(short = false) { this.tvg.country = this.tvg.country.toUpperCase() let info = `-1 tvg-id="${this.tvgId}" tvg-name="${this.tvgName}" tvg-country="${this.tvg.country}" tvg-language="${this.tvg.language}" tvg-logo="${this.logo}"` @@ -208,10 +208,16 @@ class Channel { info += `\n#EXTVLCOPT:http-user-agent=${this.http['user-agent']}` } + return info + } + + toString(short = false) { + const info = this.getInfo(short) + return '#EXTINF:' + info + '\n' + this.url + '\n' } - toJSON() { + toObject() { return { name: this.name, logo: this.logo || null,