Update scripts

This commit is contained in:
freearhey 2025-04-02 07:13:39 +03:00
parent 37664b49b9
commit 5dd131e2d3
15 changed files with 274 additions and 204 deletions

View file

@ -2,10 +2,11 @@ import { Logger, Storage, Collection } from '@freearhey/core'
import { ChannelsParser } from '../../core'
import path from 'path'
import { SITES_DIR, API_DIR } from '../../constants'
import { Channel } from 'epg-grabber'
import epgGrabber from 'epg-grabber'
type OutputItem = {
channel: string | null
feed: string | null
site: string
site_id: string
site_name: string
@ -31,9 +32,13 @@ async function main() {
logger.info(` found ${parsedChannels.count()} channel(s)`)
const output = parsedChannels.map((channel: Channel): OutputItem => {
const output = parsedChannels.map((channel: epgGrabber.Channel): OutputItem => {
const xmltv_id = channel.xmltv_id || ''
const [channelId, feedId] = xmltv_id.split('@')
return {
channel: channel.xmltv_id || null,
channel: channelId || null,
feed: feedId || null,
site: channel.site || '',
site_id: channel.site_id || '',
site_name: channel.name,

View file

@ -7,6 +7,7 @@ async function main() {
const requests = [
client.download('channels.json'),
client.download('feeds.json'),
client.download('countries.json'),
client.download('regions.json'),
client.download('subdivisions.json')