diff --git a/epg-worker.ts b/epg-worker.ts index 68904dc5c..0295970b7 100644 --- a/epg-worker.ts +++ b/epg-worker.ts @@ -72,11 +72,17 @@ ipcRenderer.on(EPG_FETCH, (event, arg) => { // returns the epg data for the provided channel name and date ipcRenderer.on(EPG_GET_PROGRAM, (event, args) => { + const channelName = args.channel.name; + const tvgId = args.channel.tvg?.id; if (!EPG_DATA || !EPG_DATA.channels) return; const foundChannel = EPG_DATA?.channels?.find((epgChannel) => { - if ( + if (tvgId) { + if (tvgId === epgChannel.id) { + return epgChannel; + } + } else if ( epgChannel.name.find((nameObj) => { - if (nameObj.value.trim() === args.channelName.trim()) + if (nameObj.value && nameObj.value.trim() === channelName.trim()) return nameObj; }) ) { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index dcbc999da..653c1aa38 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -48,9 +48,9 @@ export class AppComponent { commandsList = [ new IpcCommand(VIEW_ADD_PLAYLIST, () => this.navigateToRoute('/')), new IpcCommand(VIEW_SETTINGS, () => this.navigateToRoute('/settings')), - new IpcCommand(EPG_FETCH_DONE, () => this.onEpgFetchDone), - new IpcCommand(EPG_ERROR, () => this.onEpgError), - new IpcCommand(SHOW_WHATS_NEW, () => this.showWhatsNewDialog), + new IpcCommand(EPG_FETCH_DONE, () => this.onEpgFetchDone()), + new IpcCommand(EPG_ERROR, () => this.onEpgError()), + new IpcCommand(SHOW_WHATS_NEW, () => this.showWhatsNewDialog()), ]; /** Default language as fallback */ diff --git a/src/app/state/channel.store.ts b/src/app/state/channel.store.ts index dd5c4ce0e..efa85983f 100644 --- a/src/app/state/channel.store.ts +++ b/src/app/state/channel.store.ts @@ -1,14 +1,14 @@ import { Injectable } from '@angular/core'; import { EntityState, EntityStore, StoreConfig } from '@datorama/akita'; +import * as moment from 'moment'; import { CHANNEL_SET_USER_AGENT, EPG_GET_PROGRAM, PLAYLIST_UPDATE_FAVORITES, } from '../../../shared/ipc-commands'; -import { Channel } from './channel.model'; -import * as moment from 'moment'; import { EpgProgram } from '../player/models/epg-program.model'; import { DataService } from '../services/data.service'; +import { Channel } from './channel.model'; export interface ChannelState extends EntityState { active: Channel; @@ -65,7 +65,7 @@ export class ChannelStore extends EntityStore { this.update((store) => { if (store.epgAvailable) { this.electronService.sendIpcEvent(EPG_GET_PROGRAM, { - channelName: channel.name, + channel, }); if (channel.http['user-agent']) { this.electronService.sendIpcEvent(CHANNEL_SET_USER_AGENT, {