mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
24 lines
583 B
TypeScript
24 lines
583 B
TypeScript
import { parseChannels } from 'epg-grabber'
|
|
import { Storage, Collection } from '@freearhey/core'
|
|
|
|
type ChannelsParserProps = {
|
|
storage: Storage
|
|
}
|
|
|
|
export class ChannelsParser {
|
|
storage: Storage
|
|
|
|
constructor({ storage }: ChannelsParserProps) {
|
|
this.storage = storage
|
|
}
|
|
|
|
async parse(filepath: string) {
|
|
let parsedChannels = new Collection()
|
|
|
|
const content = await this.storage.load(filepath)
|
|
const channels = parseChannels(content)
|
|
parsedChannels = parsedChannels.concat(new Collection(channels))
|
|
|
|
return parsedChannels
|
|
}
|
|
}
|