diff --git a/scripts/format.js b/scripts/format.js index 8d28d3dbe..d02315b3e 100644 --- a/scripts/format.js +++ b/scripts/format.js @@ -153,7 +153,7 @@ async function main() { console.log(`Updating '${country.url}'...`) helper.createFile(country.url, playlist.getHeader()) channels.forEach(channel => { - helper.appendToFile(country.url, channel.toString()) + helper.appendToFile(country.url, channel.toShortString()) }) } @@ -164,7 +164,7 @@ async function main() { console.log(`Updating 'channels/unsorted.m3u'...`) helper.createFile('channels/unsorted.m3u', playlist.getHeader()) Object.values(unsorted).forEach(channel => { - helper.appendToFile('channels/unsorted.m3u', channel.toString()) + helper.appendToFile('channels/unsorted.m3u', channel.toShortString()) }) } diff --git a/scripts/helper.js b/scripts/helper.js index 787b01a98..5ef3a8094 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -256,6 +256,13 @@ class Channel { } toString() { + const country = this.countryCode.toUpperCase() + const info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" tvg-country="${country}" group-title="${this.group}",${this.title}` + + return '#EXTINF:' + info + '\n' + this.url + '\n' + } + + toShortString() { const info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" group-title="${this.group}",${this.title}` return '#EXTINF:' + info + '\n' + this.url + '\n'