mirror of
https://github.com/iptv-org/iptv
synced 2025-12-22 13:27:29 -05:00
Update Playlist.js
This commit is contained in:
@@ -11,17 +11,21 @@ module.exports = class Playlist {
|
|||||||
this.updated = false
|
this.updated = false
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(options = {}) {
|
getHeader() {
|
||||||
const config = { raw: false, ...options }
|
let header = ['#EXTM3U']
|
||||||
let parts = ['#EXTM3U']
|
|
||||||
for (let key in this.header.attrs) {
|
for (let key in this.header.attrs) {
|
||||||
let value = this.header.attrs[key]
|
let value = this.header.attrs[key]
|
||||||
if (value) {
|
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) {
|
for (let channel of this.channels) {
|
||||||
output += channel.toString(config.raw)
|
output += channel.toString(config.raw)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user