XMLTV / xmltv

Utilities to obtain, generate, and post-process TV listings data in XMLTV format
GNU General Public License v2.0
275 stars 93 forks source link

How to load tv_grab_uk_tvguide EPG data into TvHeadend using command line #94

Closed FlexMcMurphy closed 4 years ago

FlexMcMurphy commented 4 years ago

Regarding issue #93 closed just now. I don't think it is clear that my problem is with Tvheadend. So I think you closed that issue prematurely.

The epg data I got by running the tv_grab_uk_tvguide grabber. I would like to try and load it into TVHeadend using the command line method.

In a previous response to issue #93 you said to run this command: tv_grab_uk_tvguide --days 3 --output /home/osmc/my_listings

Working this way, how would I then load the downloaded files into TvHeadend? Can you give me the commands please?

Thank you for your help,

Flex

honir commented 4 years ago

This project stops at the point of generation of the xml data file. How you get that into whichever of the many downstream client apps you are using is not an xmltv issue.

A good starting point would be the "XMLTV" forum on tvheadend.org where your question is regularly discussed.

If you have an issue with tv_grab_uk_tvguide --days 3 --output /home/osmc/my_listings not generating xml data file then let me know. Otherwise your next steps lie outside of the scope of the XMLTV Project.

FlexMcMurphy commented 4 years ago

Hi,

Well out of interest, does tv_grab_uk_tvguide actually generate xml data?

An example file that it downloaded for me earlier seems to be an html file? I attached it here where I added a .txt extension so it would attach.

Also I think there was a problem with this grabber and was awaiting a new xmltv version... unless that has been sorted now? At least when I installed xmltv-util it gave me the broken tv_grab_uk_tvguide which gave the error:

Can't call method "look_down" on an undefined value at /usr/bin/tv_grab_uk_tvguide line 758.

Unless that is a problem with osmc, where I downloaded it from, in which case please accept my deepest apologies for wasting so much of your time.

Cheers,

Flex

53534f5c8b5151e41dea3db0187bbe4f.txt

honir commented 4 years ago

The files in the cache will be HTML since these are the website pages retrieved from the TV Guide website. These files are not the final output from the grabber but represent an interim step. The cache is used to speed up subsequent grabs (when possible) and to avoid excessive load on the TV Guide website.

The output from the grabber is determined by the --output parameter (or the default if this param not given). This file is an XML file.

It is likely that OSMC is not yet up to date with the recent changes as you point out. We can't control when the downstream programs update their packages, but if you contact the OSMC guys they should be able to update the OSMC package for you. (The issue you mention was fixed in the grabber over a year ago.)

Alternatively you can download the latest tv_grab_uk_tvguide from our git repository here and simply overwrite the version of "tv_grab_uk_tvguide" that came with OSMC.

FlexMcMurphy commented 4 years ago

Hi again,

Brilliant. Now I'm starting to understand how this works. Indulge me the excess detail here, it's for the benefit of other confused souls like myself who may land here..

I did another test:

This file: /home/osmc/.xmltv/tv_grab_uk_tvguide.conf contains simply...

cachedir=/home/osmc/.xmltv/cache
channel=498

And this file: /home/osmc/.xmltv/supplement/tv_grab_uk_tvguide/tv_grab_uk_tvguide.map.conf contains simply... map==498==CBS Justice

Then I ran this command: tv_grab_uk_tvguide --days 1 --output /home/osmc/my_listings

Took about 2mins to complete and downloaded 34 html files to: /home/osmc/.xmltv/cache

And created an xml file called: /home/osmc/my_listings

Now after enabling the External:XMLTV Grabber I can load this epg data into TvHeadend with a command like: cat my_listings | socat - UNIX-CONNECT:xmltv.sock

This will give me epg data for the CBS Justice channel.

Question Over the last few days, after running tv_grab_uk_tvguide --configure and with the config files in the correct places, I tried running this command several times: tv_grab_uk_tvguide

It was downloading html files to: /home/osmc/.xmltv/cache But I can't see where it saved any xml file to?

If you don't specify an --output parameter where is the default location for the xml file? If it's supposed to be somewhere in /home/osmc/.xmltv then it doesn't create an xml file when I run it with no parameters.. tv_grab_uk_tvguide

Actually I ran it again now like this: tv_grab_uk_tvguide --days 1

And I see the XML sent to the command line output.. so is that the default location? By the way it downloaded 34 files again even though it was only an hour or so since I last ran it and also downloaded 34 files then? Doesn't seem to be re-using those files in the cache dir very efficiently?

Thanks for your help,

Flex

honir commented 4 years ago

The default location is STDOUT so you would normally use an --output parameter. But it does allow you to pipe the output to another program if you wish.

See http://wiki.xmltv.org/index.php/HowtoUseGrabbers http://wiki.xmltv.org/index.php/XmltvCapabilities

The cache for this grabber only retains for 60 minutes. Some people like to get last minute changes to tv schedules so want the cache time kept short.

Generally, people only download once a day so the actual benefit of a cache may be limited ;)

FlexMcMurphy commented 4 years ago

Thanks a lot Geoff.

I feel much more confidant in how to use this grabber now.

Flex