iptv/scripts/models/playlist.ts
2023-09-15 18:40:35 +03:00

29 lines
524 B
TypeScript

import { Collection } from '../core'
import { Stream } from '../models'
type PlaylistOptions = {
public: boolean
}
export class Playlist {
streams: Collection
options: {
public: boolean
}
constructor(streams: Collection, options?: PlaylistOptions) {
this.streams = streams
this.options = options || { public: false }
}
toString() {
let output = `#EXTM3U\n`
this.streams.forEach((stream: Stream) => {
output += stream.toString(this.options) + `\n`
})
return output
}
}