Jump to content

Using the COM interface is easy!


Delphi

Recommended Posts

Originally I just wanted to translate an AutoIt script (for importing XMLTV) into Delphi, since the AVG antivirus gave false positives on the exe file created by AutoIt.

 

Well, one line of code took the other, so I ended up with programming it all from scratch instead of just calling the myXMLTV.exe from my application. I have really enjoyed taking up Delphi again after a break of 10 years.

 

You can read more about my tool (and download it) here:

 

http://www.DVBViewer.info/forum/index.php?...=20539&st=0

 

I know, that Lars is planning another way of doing this kind of stuff (Quote from the EPGPlus tread):

 

"I would wait a little with such a project, cause I'm planing to make a access library to unify access to the DVBViewer, DVBservice or offline data. So you simply use this library and it takes care of connecting to the viewer, the service or directly with the files."

 

Anyway, now that I have started (and announced) it, I want to finish it (I know an app is never finished).

 

 

1) Append or replace EPG

Short version:

Is there a way to delete all EPG from DVBV when DVBV is running (without closing DVBViewer)?

Long version:

In my case I have small EPG (takes app. 10 secs to import) for one week ahead. On a daily basis the TV programme on the site where it is grabbed is changed, so what I want is to remove any old EPG, then replace with the new one for the whole week.

If you have a huge EPG and you trust that no TV program changes uccur, you might want to download/grab for the newest available day only, and then just import that day (append EPG).

 

If the user hits the "Test Import" in my app.and DVBV is running I ask the user to close it. I then simply delete the files epg.bak and epg.dat, then relaunches DVBV, effectively deleting any old EPG. This is not a satisfactory solution if the import should take place as a sceduled task. Closing DVBV gracefully from COM in this case requires at least some checking of running and programmed timers. A simpler solution is preferred.

 

The docu states, that you cannot change any existing EPG in DVBV. Well, if the EventID exist in DVBV and you use the same one, the EPG is overwritten. A solution to delete old EPG could be to read existing EventID's then reuse them. Probably there will be fewer active EventID's in the old EPG compaired to the new one, so this should work quite safe. Again a simpler solution is preferred.

 

I use the start time (discards seconds, Year mod 10) to create the EventID's. This way existing EPG with same starttime will be overwritten. But if new TV programmes with new starttimes on an old day has arrived, there is a problem. Any better ways?

 

2) Problems with SendCommand(12323) (Hibernate) and SendCommand(12296) (Shutdown)

Hibernate becomes Standby and Shutdown only closes DVBV, or am I missing something?

Reproduce: Add a button to the main form of DVBVSpy (Oh, that great demo!), then simply call SendCommand in the onclick event.

 

3) An OnDVBVCloseQuery Event?

I use the OnDVBVClose event to detect if DVBV is closed during import. I cannot send en OSD warning or prevent DVBViewer from closing, or am I missing something?.

Anyway I think (not sure) I will request some kind of OnCloseQuery event (should eventually display an OSD warning) if this is possible in some sensible way.

 

 

Another solution could be to use the buildt in Alarm timers. I don't know much about them. @Lars: I certainly would love to see some Delphi code on this subject.

 

4) Is it possible to mix XMLTV EPG and antenna EPG?

If yes, how?

 

5) What to do if more than one instance of DVBV is installed/running?

For a start I used FDVBViewer.ConnectKind := ckRunningOrNew. This way the EPG was not always saved, so I changed to ConnectKind := ckRunningInstance and required that the ImportXMLTV.exe should reside in a subfolder to DVBV's program folder.

Additionally this means that I can launch the intended instance of DVBViewer using ShellExecute (should probably be ShellExecuteW).

Is there a smart way to handle the situation where a "wrong" instance of DVBViewer is running. I have stolen (including the author notice) the FindinROT procedure from DVBVSpy.

 

 

 

Any answers/suggestions will be apreciated (maybe those ones I didn't even think of is the most interesting)

 

 

Thanks in advance

Edited by Delphi
Link to comment
  • 1 month later...

2) Sorry about that one. Not DVBViewer's fault, my fault!

Well, I had some troubles waking up my PC using the MCE remote. I then the used the MCE Standby tool (great tool). This one redirects a Hibernate request to standby if set up to do so.

Before I reported this "error" I tested on another PC. Unfortunatly I had resently re-setup windows XP on that one and then forgot to enable hibernate. Shame on me! :bounce:

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