TVHeadEnd & tv_grab_file from web-link?

I’m struggling to get TVH to download a web-based IPTV EPG from a link of the format of http://iptvprovider.com:8080/xmltv.php?username=xxxx&password=xxxx

In LibreElec (which I’ve ditched as it doesn’t support ffmpeg) it was a simple as enabling the internal tv_grab_file grabber, going into the TVH server add-on and configuring the web address in the front-end.

I’ve managed to download tv_grab_file from github and make it an executable grabber in tvheadend (as it’s not there in OSMC) - it now lists it in the TVH web-gui, but I’m struggling to get it to point at my EPG’s web address (or do anything, in fact).

In OSMC, there is no equivalent front-end of TVH Server (as you can only access it via the web-address, e.g. 192.168.0.18:9981). The tv_grab_file script says it reads the contents of “~/.xmltv/tv_grab_file.xmltv”, so how would I get my web-based EPG into that? A cron job? If so, how?

I’ve also tried alternative Bash scripts from the OSMC forums, for the external grabber and xmltv.sock, but the two scripts I’ve found don’t work (they even seem to have the wrong addresses, stating “/hts/.hts” where osmc has “osmc/.hts” so error continuously) and then they can’t access my web-address (above) as they seem to cut off from the “&” sign and get blocked.

Can anyone give me simple instructions (or a link to some) on how I get my web-based EPG into TVH, please?

Thanks!

Yes, a cronjob would make sense for this.

So it sounds like you want to put the file in /home/osmc/.xmltv/tv_grab_file.xmltv. You will likely need to create /home/osmc/.xmltv manually

Sam

…and what would the cron job look like? …and how would I set it to run…?

I’ve used tiny-url to remove a problematic ampersand from the web-address, but it seems to link to an xmltv.php file (rather than “epg.xml”) and now I’m lost.

(I’m feeling rather frustrated/stoopid, after already spending hours to try to do in OSMC and TVH what I did in Libreelec quite easily (to then try to solve an underlying stalling stream problem, and I’m sure someone must have surpassed all this quite easily. It feels like I may have known all this a few years back but my brain appears to have melted!)

Hi,

I would try this and set it to run once a day:

/usr/bin/wget -q --output-document=/home/osmc/.xmltv/tv_grab_file.xmltv "http://iptvprovider.com:8080/xmltv.php?username=xxxx&password=xxxx"

Quotes let you keep the symbols, -q to overwrite.

It may be better to through it into a bash script and get the cronjob to call the script instead.

Thanks Tom.

I actually think that may have cracked it. I stuck that in an executable bash script - ran it and it works… and now I’ve created a cron job to run it 15 minutes before the internal grabber runs.

Fingers crossed - and many thanks both!

Could you let us know what is in LE that makes it easier than OSMC? It’s something we would like to simplify

Cheers

Hi Sam - sorry for the delay - I started with LE and the part that was easier was the XMLTV grabbing - it had more grabbers, from the start, and LE’s TVHeadEnd Server front-end in Kodi’s GUI had the option to configure an external web address to grab an EPG from, and then just enable that grabber in the back-end (TVH Server).

I’ve been on a steep learning curve for Bash, Perl, ffmpeg transcoding and all sorts lately (to get some finally stable IPTV streams - the reason for the delay, no less), so that was the least of my troubles, but it was definitely easier in LE.

Everything else has been mighty fine since, though. I’m quite enjoying being back in the fray. :wink:

Hello RSD

I found your post here when I was looking for help to populate my TVHeadend server with EPG data.

I´m running my TVH server on LibreELEC 8.2.5 and I know the system is very limited as what you can do with it.

I have been trying to get EPG data In to my TVH server for a long time (3-4 attempts :slight_smile: ) but has had no luck.

When I read the easy way you did it I got hope again :slight_smile:
But I can’t get it to work.

The problems/questions I have is:

  1. In TVHeadEnd Server front-end in Kodi’s GUI I go in to settings, and you have 3 options under the XMLTV section. You can choose FILE, WEB and SCRIPT.
    I put a web adress to a xml file for the EPG data.

  2. in TVH server web-gui i have activated the internal grabber “XMLTV: tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi”

  3. then I run it, but the grabber gives me nothing. (look the log text)

2019-02-15 19:32:22.615 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: grab /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file
2019-02-15 19:32:22.629 spawn: Executing “/storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file”
2019-02-15 19:32:35.435 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: grab took 13 seconds
2019-02-15 19:32:35.436 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: parse took 0 seconds
2019-02-15 19:32:35.436 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: channels tot= 0 new= 0 mod= 0
2019-02-15 19:32:35.436 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: brands tot= 0 new= 0 mod= 0
2019-02-15 19:32:35.436 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: seasons tot= 0 new= 0 mod= 0
2019-02-15 19:32:35.436 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: episodes tot= 0 new= 0 mod= 0
2019-02-15 19:32:35.436 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: broadcasts tot= 0 new= 0 mod= 0

Can you help me, have I missed something?

Hi - it’s been a while since I set mine up, but I’ll try. The main problem here is that I run my RPi as a headless server, so I don’t have the Kodi UI options, only Putty and the web UI. I also couldn’t see the UI options in OSMC, when I did first connect it, but that could just be because it was a previous version… some time ago!

Anyway, my “tv_grab_file” EPG grabber only takes the xml file from one location on the rpi’s file system; “/home/osmc/.xmltv/tv_grab_file.xmltv”. I tried to get other versions of the EPG grabber, but no joy, so in the end, I wrote a very small Bash script with one “wget” command to download the file from my web address (I use iptv-epg.com - a paid service - but you have other options) and then save it to the location tv_grab_file needs.

I then put that script in a chron job that runs every hour (at 25 past)… and then set the epg grabber options in the TVHeadEnd UI to run five minutes later, at 30 mins past each hour, to pick it up and use it.

It was a little complicated for a complete newbie (as was) but it works.

I hope that helps, as I think what you’re seeing is the result of two different things; the Kodi UI doing one (externally), and the TVH web UI doing another (and failing to find a file internally).

…and by the way, I gave up on LibreElec very early on. If I remember rightly, it didn’t do some other things I wanted, and I’d always found OSMC better supported. That’s why mine is different (in terms of file location). After some years, I spent some time away from osmc, and then came back and I haven’t left again. I have two rpi’s running it and haven’t had a single problem since September (apart from with my IPTV providers, but that’s another subject entirely!)…

Oh thanks for the quick answer :+1::slightly_smiling_face:
But I was referring to the setup when you used LibreELEC as OS not OSMC. I am using LibreELEC again as my OS for the TVH server (the hardware is a raspberry Pi 3 model 3)

I switched to a PC with Linux Mint for a while, to try it out, if I could get the EPG to work there.
But :thinking::roll_eyes: I think I it was some problem with rights/privileges or the file hierarchy .

Im not a Linux person :joy:

But if you could help me to get it going in OSMC, I switch and try that off course .

And thanks again for replying so fast on the old post/subject :+1:

I saw that, but I can only answer with what I know. You’re on an OSMC forum, though.

Like I said in my earlier posts, I tried LE but couldn’t get it to work. It did some things easier than OSMC but didn’t do everything I needed.

That said, if it’s permissioning, you just need to change the permissions on the file, via putty. That tripped me up a couple of times. You may need to do a “sudo chmod…”, change the permissions and sometimes even change the owner of a file.

There’s also a TVH forum out there - there are some helpful folks there too…

1 Like

Yes you are right, I’m in the wrong forum for that question :sweat_smile:
But as I said, you have a solution to get it to work in OSMC? Im happy to try that.
A step by step guide :pray: :slightly_smiling_face: