From 2a1eb57c05f126cd5913aa91018866b724c33722 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 16 Sep 2021 03:30:52 +0300 Subject: [PATCH] Update Playlist.js --- scripts/helpers/Playlist.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/helpers/Playlist.js b/scripts/helpers/Playlist.js index 6b797c96c6..0df181a2da 100644 --- a/scripts/helpers/Playlist.js +++ b/scripts/helpers/Playlist.js @@ -11,17 +11,21 @@ module.exports = class Playlist { this.updated = false } - toString(options = {}) { - const config = { raw: false, ...options } - let parts = ['#EXTM3U'] + getHeader() { + let header = ['#EXTM3U'] for (let key in this.header.attrs) { let value = this.header.attrs[key] if (value) { - parts.push(`${key}="${value}"`) + header.push(`${key}="${value}"`) } } - let output = `${parts.join(' ')}\n` + return header.join(' ') + } + + toString(options = {}) { + const config = { raw: false, ...options } + let output = `${this.getHeader()}\n` for (let channel of this.channels) { output += channel.toString(config.raw) }