Files
epg/scripts/core/channelsParser.ts

23 lines
540 B
TypeScript
Raw Normal View History

2023-10-15 14:08:23 +03:00
import { parseChannels } from 'epg-grabber'
2025-07-18 22:51:01 +03:00
import { Storage } from '@freearhey/core'
import { ChannelList } from '../models'
2023-10-15 14:08:23 +03:00
type ChannelsParserProps = {
storage: Storage
}
export class ChannelsParser {
storage: Storage
constructor({ storage }: ChannelsParserProps) {
this.storage = storage
}
2025-07-18 22:51:01 +03:00
async parse(filepath: string): Promise<ChannelList> {
2023-10-15 14:08:23 +03:00
const content = await this.storage.load(filepath)
2025-07-18 22:51:01 +03:00
const parsed = parseChannels(content)
2023-10-15 14:08:23 +03:00
2025-07-18 22:51:01 +03:00
return new ChannelList({ channels: parsed })
2023-10-15 14:08:23 +03:00
}
}