evgen_ln Posted June 17, 2009 Share Posted June 17, 2009 Hello. Tell me please, where I was mistaken. Why this code adds only last EPGItem from EPGCollection to the DVBViewer EPGengine . var EPGCollection: IEPGCollection; NewEPGItem, EPGItem:IEPGItem; FAddEPG: IEPGAddBuffer; chan: IChannelItem; chan_new: IChannelItem; temp: String; i,a: integer; time: TDateTime; begin FAddEPG:=FEpgMgr.AddEPG; chan:= FChans[FChans.GetbyChannelname('Discovery HD (rus)')]; chan_new:= FChans[FChans.GetbyChannelname('M1')]; if (chan <> nil) then if FEpgMgr.HasEPG(chan.EPGChannelID) then begin Memo1.Lines.Add(' '); Memo1.Lines.Add(chan.Name); Memo1.Lines.Add(' '); EPGCollection:=FEpgMgr.Get(chan.Tuner.SID, chan.Tuner.TransportStreamID,Today,Tomorrow); For i:=0 to EPGCollection.Count-1 do begin EPGItem:=EPGCollection.Item[i]; if EPGItem <> nil then begin Memo1.Lines.Add(DateTimeToStr(EPGItem.Time)+ ' ' +EPGItem.Title + ' ' + inttostr(EPGItem.EPGEventID)); NewEPGItem:=FAddEPG.NewItem; NewEPGItem.SetEPGEventID(chan_new.Tuner.SID, chan_new.Tuner.TransportStreamID); NewEPGItem.Charset:= EPGItem.Charset; NewEPGItem.Content:= EPGItem.Content; NewEPGItem.Description:= EPGItem.Description; NewEPGItem.Duration:= EPGItem.Duration; NewEPGItem.Event:= EPGItem.Event; NewEPGItem.Time:= EPGItem.Time; NewEPGItem.Title:= EPGItem.Title; FAddEPG.Add(NewEPGItem); FAddEPG.Commit; end; end; FAddEPG.Commit; end; Quote Link to comment
Lars_MQ Posted June 17, 2009 Share Posted June 17, 2009 You need to set the (per channel) unique eventID for the item, otherwise the Viewer won't accept it. I simply use in such a case: NewEPGitem.eventID:=EPGItem.eventID; Should work for you, since you seem to use a different EPGChannelID (aka badly named EPGEventID). Quote Link to comment
evgen_ln Posted June 17, 2009 Author Share Posted June 17, 2009 Thanks you, all work Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.