Forums » Tutorial and setups »
EPG XMLTV tv_grab_na_dd
Added by D. Bush about 9 years ago
(crossposted from XMLTV)
So I've installed XMLTV, run tv_grab_na_dd, successfully connected to my Schedules Direct account, and selected the correct internal module on the EPG Grabber configuration screen. Cannot get the EPG to load. Is there a step I'm missing? What would be helpful to see in a log file?
Replies (7)
RE: EPG XMLTV tv_grab_na_dd - Added by cilin dro about 9 years ago
first zap2it is better than schedules direct. Second you need put guide manual channel by channel in channels tab.
RE: EPG XMLTV tv_grab_na_dd - Added by D. Bush about 9 years ago
I hadn't been able to select any channels in the channels tab.
Also, I'm thinking that whatever's missing for getting SD set up would also be missing for setting up Zap2it.
RE: EPG XMLTV tv_grab_na_dd - Added by K Shea about 9 years ago
Just out of curiosity, have you tried closing and re-opening the browser? Or clearing cookies? Sometimes it won't show the channels until you do.
If that doesn't work:
Go to the Channels/EPG tab and under that the EPG Grabber tab. Bring up the debug window (there is a small icon in the lower right corner of the screen containing a doubble ^ character, click on that). Temporarily change the grabber from tv_grab_na_dd to Disabled and click on Save configuration. Then change it back to tv_grab_na_dd and click on Save configuration again. As you do that, watch the debug window - it should give you some indication that it is importing the channels. If it doesn't, something is wrong in your setup.
In any case, I agree that Zap2it is a better choice; for that you'd use zap2xml(http://zap2xml.awardspace.info/) to grab the schedule data (see instructions on that page), and tv_grab_file (https://github.com/Rigolo/tv-grab-file) as the grabber used in TVHeadend to import the tv_grab_file.xmltv file (which should be the name given to the output file when you run zap2xml). tv_grab_file goes in the /usr/bin directory along with the other grabbers, and make sure that the file permissions and ownership are set to the same as the other grabbers in that directory (the file must be executable, and the owner and group must be root).
RE: EPG XMLTV tv_grab_na_dd - Added by D. Bush about 9 years ago
Very nearly there! I was able to manually run zap2xml, save tv_grab_file.xmltv, assign channels, and get the EPG to recognize and populate it.
Now I just have to get it to do that automatically. I assume that goes in the EPG internal cron? Could you share an example of one that works for you?
RE: EPG XMLTV tv_grab_na_dd - Added by K Shea about 9 years ago
What I did was to create a bash shell script that runs all the commands that you are now running manually. Three things to know about shell scripts:
1. The first two lines should likely be this:
#!/bin/sh
cd ~/<directory where zap2xml is located>
2. If you have a program that will not run from within the shell script, make use you specify the full path and program name (which you can obtain using the which command). For example let's say you want to create text file containing the date, so you can check to see when the script last ran. Ordinarily you might do this:
date > lastrun.txt
But it may not work in a shell script because you aren't using the full path, so you'd execute "which date" from the command line, which will likely show you it's at /bin/date. So, you'd use this instead:
/bin/date > lastrun.txt
3. Make sure your shell script it executable, and owned by whichever user will be running it (you, or hts or whatever).
Just put whatever you are doing manually into the shell script, then try running the shell script manually and make sure it does everything it's supposed to do.
Now, the cron job thing in TVHeadend is only for telling TVheadend when to read the contents of the tv_grab_file.xmltv file. What you need to do is create a Linux cron job to run your batch file once a day. Now I can't tell you exactly how to do that because I always install Webmin on my servers and use that to do a lot of Linux-y tasks that I wouldn't otherwise know how to do. In Webmin I just created a scheduled cron job to run once a day in the early AM hours. In order to be nice to the servers I pick a random oddball time, not on an hour or half-hour mark. So let's say you create a cron job to run your shell script at 4:37 AM each morning (pick some other random time, please). Remember you must specify the full path to your shell script and also be aware of which user is running the cron job - if you want the tv_grab_file.xmltv file to be readable by TVHeadend then you want to run the cron job as the TVHeadend user (probably hts). Webmin lets you specify the user when you create a cron job but I suppose you could also change users from the command line (using "sudo su hts" for example) and then maybe set up your cron job using "crontab -e" (?).
Anyway, assuming you have set up your cron job to do this and everything seems to be working (it is creating a new tv_grab_file.xmltv file each day) then the only remaining thing to do is set the "Cron multi-line" field in the Internal grabber section. I usually give the shell script ten minutes to do its thing (normally it takes less than a minute, so ten minutes should be plenty unless you are importing a HUGE channel list) so continuing with this example, if you have the cron job run the shell script at 4:37, then you'd let TVHeadend import it at 4:47, by putting this in the "Cron multi-line" field (after erasing any default settings there):
47 4 * * *
To be clear, your LINUX cron job creates the day's new tv_grab_file.xmltv at 4:37 AM, and then at 4:47 AM TVheadend imports it into its database (again, please pick random oddball times so that everyone isn't trying to access the servers at once).
If anything appears to not work, check permissions and ownership, and check that you have specified full paths, particularly in your cron job setup. Cron jobs appear to be particularly dumb about paths so you have to give them full paths to everything, or they can't find anything. A bash script that works fine when you run it as a user will often fail when run as a cron job if full paths aren't specified. Sorry if I am telling you stuff you already know, but I banged my head against the desk several time trying to figure out why this wouldn't work at first, and it all came down to not specifying full paths. Hope this helps.
By the way, I would be remiss if I did not point out that there is supposed to be another way to do this, using xmltv.sock. As with so many things about TVHeadend this is rather poorly documented (in any manner that a typical user can understand); there is a thread about it on the Kodi forum at http://forum.kodi.tv/showthread.php?tid=216393 but even after reading that I am not at all sure how you'd use it in practice. So, I just stick to what I know works!
RE: EPG XMLTV tv_grab_na_dd - Added by D. Bush about 9 years ago
Thank you, that was really helpful! I have a pretty simple script file:
#!/bin/bash # Zap2It user info user= pwd= # Output file out="/home/hts/.xmltv/tv_grab_file.xmltv" zap2xml.pl -u $user -p $pwd $out
And a cron job for admin to run it every day at 4 am.
RE: EPG XMLTV tv_grab_na_dd - Added by K Shea about 9 years ago
It's okay to run it as admin as long as the output file is world readable (specifically, readable by the TVHeadend user) and is in the location where tv_grab_file expects it to be (which in your case it is, because you specified the path). You probably know that already, but I mention it for the benefit of anyone else that may not be aware of how Linux permissions can trip you up.
I would really encourage you not to run your cron job exactly on the hour, though. If everyone does that they are going to see massive spikes on their server traffic each hour and that could cause problems down the road. Be considerate and run the cron job on some random odd minute, please!