mirror of https://github.com/iptv-org/iptv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
532 B
TypeScript
29 lines
532 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\n'
|
|
|
|
this.streams.forEach((stream: Stream) => {
|
|
output += stream.toString(this.options) + '\n'
|
|
})
|
|
|
|
return output
|
|
}
|
|
}
|