mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 01:50:04 -04:00
Update playlist.js
This commit is contained in:
parent
714f38d9d7
commit
52921aeffa
1 changed files with 2 additions and 28 deletions
|
@ -1,4 +1,5 @@
|
|||
const store = require('./store')
|
||||
const m3u = require('./m3u')
|
||||
const _ = require('lodash')
|
||||
|
||||
const playlist = {}
|
||||
|
@ -50,34 +51,7 @@ class Playlist {
|
|||
}
|
||||
|
||||
toString() {
|
||||
let output = `#EXTM3U`
|
||||
for (const attr in this.header) {
|
||||
const value = this.header[attr]
|
||||
output += ` ${attr}="${value}"`
|
||||
}
|
||||
output += `\n`
|
||||
|
||||
for (const link of this.links) {
|
||||
output += `#EXTINF:-1`
|
||||
for (const name in link.attrs) {
|
||||
const value = link.attrs[name]
|
||||
if (value !== undefined) {
|
||||
output += ` ${name}="${value}"`
|
||||
}
|
||||
}
|
||||
output += `,${link.title}\n`
|
||||
|
||||
for (const name in link.vlcOpts) {
|
||||
const value = link.vlcOpts[name]
|
||||
if (value !== undefined) {
|
||||
output += `#EXTVLCOPT:${name}=${value}\n`
|
||||
}
|
||||
}
|
||||
|
||||
output += `${link.url}\n`
|
||||
}
|
||||
|
||||
return output
|
||||
return m3u.create(this.links, this.header)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue