mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-11 01:20:04 -04:00
28 lines
536 B
TypeScript
28 lines
536 B
TypeScript
import { Collection } from '@freearhey/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\r\n'
|
|
|
|
this.streams.forEach((stream: Stream) => {
|
|
output += stream.toString(this.options) + '\r\n'
|
|
})
|
|
|
|
return output
|
|
}
|
|
}
|