Jump to content

EPG


evgen_ln

Recommended Posts

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;

Link to comment

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).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...