Files
iptv/scripts/models/playlist.ts

29 lines
536 B
TypeScript
Raw Normal View History

2023-09-22 05:17:22 +03:00
import { Collection } from '@freearhey/core'
2023-09-15 18:40:35 +03:00
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() {
2025-04-23 05:21:33 +03:00
let output = '#EXTM3U\r\n'
2023-09-15 18:40:35 +03:00
this.streams.forEach((stream: Stream) => {
2025-04-23 05:21:33 +03:00
output += stream.toString(this.options) + '\r\n'
2023-09-15 18:40:35 +03:00
})
return output
}
}