edit4ever / script.module.zap2epg

zap2epg - EPG grabber for USA/Canada
GNU General Public License v3.0
41 stars 25 forks source link

Can this script be used without Kodi? #17

Closed robman501a closed 4 years ago

robman501a commented 4 years ago

Hi, quick question. Can this script be used without Kodi just to grab the data from Zap2it and to import it to TVHeadend?

Originally posted by @robman501a in https://github.com/edit4ever/script.module.zap2epg/issues/16#issuecomment-557679696

edit4ever commented 4 years ago

Technically yes - but it requires a bit of messing around. You need to manually recreate the settings.xml file and optionally create the TVHChannels.json and channels.json files to filter the amount of channel data downloading.

For guide data without kodi - and just for TVheadend - I would use this software: http://zap2xml.awardspace.info/

You can use this file as a reference - place it in the same folder as the zap2epg.py file you are running. Change the zipcode to your location. And remove the stations under the "slist" setting

https://www.dropbox.com/s/u04y5xosb5f8mgf/settings.xml?dl=0

robman501a commented 4 years ago

I tried Zap2xml but it just doesn't work.

./zap2xml.pl -u username@gmail.com -p password -A "new" -i icons
sudo cat xmltv.xml | sudo socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock

TVHeadend log:

2019-11-23 12:25:06.097 xmltv: xmltv: grab took 1 seconds
2019-11-23 12:25:06.193 xmltv: xmltv: parse took 0 seconds
2019-11-23 12:25:06.193 xmltv: xmltv:  channels   tot=   33 new=   33 mod=   33
2019-11-23 12:25:06.193 xmltv: xmltv:  brands     tot=    0 new=    0 mod=    0
2019-11-23 12:25:06.193 xmltv: xmltv:  seasons    tot=    0 new=    0 mod=    0
2019-11-23 12:25:06.193 xmltv: xmltv:  episodes   tot=    0 new=    0 mod=    0
2019-11-23 12:25:06.193 xmltv: xmltv:  broadcasts tot=    0 new=    0 mod=    0
edit4ever commented 4 years ago

That's the first step - zap2xml downloaded the info for the 33 stations. Now you have to assign those to channels in tvheadend. Go under the CONFIGURATION > CHANNEL/EPG > CHANNELS tab in the tvheadend UI and assign the epg source to the correct channel. Then rerun the grabber from within the tvheadend UI and it should load.

wbeard52 commented 4 years ago

Zap2XML no longer works with the revamped zap2it.com website.

Get Outlook for Androidhttps://aka.ms/ghei36


From: robman501a notifications@github.com Sent: Saturday, November 23, 2019 10:29:42 AM To: edit4ever/script.module.zap2epg script.module.zap2epg@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [edit4ever/script.module.zap2epg] Can this script be used without Kodi? (#17)

I tried Zap2xml but it just doesn't work.

./zap2xml.pl -u username@gmail.com -p password -A "new" -i icons sudo cat xmltv.xml | sudo socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock

TVHeadend log:

2019-11-23 12:25:06.097 xmltv: xmltv: grab took 1 seconds 2019-11-23 12:25:06.193 xmltv: xmltv: parse took 0 seconds 2019-11-23 12:25:06.193 xmltv: xmltv: channels tot= 33 new= 33 mod= 33 2019-11-23 12:25:06.193 xmltv: xmltv: brands tot= 0 new= 0 mod= 0 2019-11-23 12:25:06.193 xmltv: xmltv: seasons tot= 0 new= 0 mod= 0 2019-11-23 12:25:06.193 xmltv: xmltv: episodes tot= 0 new= 0 mod= 0 2019-11-23 12:25:06.193 xmltv: xmltv: broadcasts tot= 0 new= 0 mod= 0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/edit4ever/script.module.zap2epg/issues/17?email_source=notifications&email_token=AHTKTG5B44VMZ332CGGSEXDQVFSANA5CNFSM4JQ2QI52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE7ZZMA#issuecomment-557817008, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHTKTG7ZZGI2LNWFHXO4L5LQVFSANANCNFSM4JQ2QI5Q.

robman501a commented 4 years ago

How do you get zap2epg.py to run though? I placed the modified settings.xml in the same folder as zap2epg.py but when I run zap2epg.py, it does nothing.

robman501a commented 4 years ago

Zap2XML no longer works with the revamped zap2it.com website. Get Outlook for Androidhttps://aka.ms/ghei36

I've noticed.

edit4ever commented 4 years ago

If you're trying to run tvheadend and have zap2epg run on its own - but not use kodi for setup. Then you also have to manually install the tv_grab_zap2epg file into your usr/bin folder and set it's permissions to be able to be used by tvheadend - which normally creates an hts user when installed.

This gets complicated - which is why my script is designed as an addon to be used from kodi for easy setup.

You can always just setup a cron job to run the zap2epg.py script and then have tvheadend look at the generated xmltv.xml file.

In your case - just manually run the zap2epg.py script from the command line for now.

edit4ever commented 4 years ago

BTW - your zap2xml program looks like it generated the start of a xmltv.xml file. It went and found the 33 channels for your lineup. But don't bother with a username/password - that's the old way. Just use the -Y and -Z settings with your lineup and zip.

robman501a commented 4 years ago

I ran it with the -Z option but it wants my login info and for the -Y option, I don't know what my lineup ID is. zap2xml (2018-12-01) Unable to login: Unspecified username or password.

robman501a commented 4 years ago

I think without knowing the lineup id, that's why I can't get tv_grab_zap2epg and zap2epg.py to run because I don't have that section filled out in the settings.xml file.

robman501a commented 4 years ago

As for running the zap2epg.py file...

pi@raspberrypi:~/xmltv/script.module.zap2epg $ ./zap2epg.py
./zap2epg.py: line 17: import: command not found
./zap2epg.py: line 18: import: command not found
./zap2epg.py: line 19: import: command not found
./zap2epg.py: line 20: import: command not found
./zap2epg.py: line 21: import: command not found
./zap2epg.py: line 22: import: command not found
./zap2epg.py: line 23: import: command not found
./zap2epg.py: line 24: import: command not found
./zap2epg.py: line 25: import: command not found
./zap2epg.py: line 26: import: command not found
./zap2epg.py: line 27: import: command not found
./zap2epg.py: line 28: import: command not found
./zap2epg.py: line 29: import: command not found
from: can't read /var/mail/os.path
./zap2epg.py: line 31: import: command not found
from: can't read /var/mail/collections
./zap2epg.py: line 33: import: command not found
./zap2epg.py: line 36: syntax error near unexpected token `('
./zap2epg.py: line 36: `def mainRun(userdata):'
edit4ever commented 4 years ago

what zipcode and what type of lineup (antenna, cable, digital cable, etc) do you need?

robman501a commented 4 years ago

I'm in Canada and we don't have a zipcode. We have a postal code which is like ... A1B 2C3 (that's made up example). I'm using an antenna.

edit4ever commented 4 years ago

that's ok - what is your postal code? We'll also have to change the country info

robman501a commented 4 years ago

Prefer not to put it out in public. Let's just use the example and I'll change it to the correct one. How do you change the country info?

edit4ever commented 4 years ago

Let's say for Toronto - for example...try the following - or replace with your postal code:

<setting id="zipcode">M4B1B3</setting>
<setting id="lineupcode">lineupId</setting>
edit4ever commented 4 years ago

It looks like there may have been a change ion how the system gets lineups - I just noticed on my tests system that I couldn't change lineups - even though the epg works.

I'll have to investigate that.

robman501a commented 4 years ago

When I run 'python zap2epg.py' it doesn't do anything. Just puts me back at the prompt within less than of a second later. Shouldn't it have grabbed the listings and made me an xmltv.xml file?

edit4ever commented 4 years ago

Could you post the zap2epg.log file that it created?

edit4ever commented 4 years ago

I just tried this with a clean download and found some errors. Try using this version for now until I have time to investigate:

https://www.dropbox.com/sh/v9vrbp2tjcbjlq7/AAC6vG2TwMj4gFsnvr_M5lQQa?dl=0

Just change the zipcode setting to your postal code in the settings.xml file.

robman501a commented 4 years ago

Thanks, that it work a little more and made me the xmltv.xml (160 bytes) and a log file.

2019/11/23 16:50:26 No channel list found - adding all stations!
2019/11/23 16:50:26 Downloading guide data for: 1574542800
2019/11/23 16:50:26 Could not download guide data for: 1574542800
robman501a commented 4 years ago

Identical results with this py file. https://github.com/edit4ever/script.module.zap2epg/blob/master/zap2epg.py

robman501a commented 4 years ago

Just to make my life more simple, in the meantime I installed Kodi.

robman501a commented 4 years ago

So, I put Kodi on and configured the addon like normal. I found out how to make an updated xmltv.xml file and import to TVheadend.

# Change to script folder
cd ~/.kodi/userdata/addon_data/script.module.zap2epg

# Update xmltv file
python zap2epg.py

# Import to tvheadend
cat xmltv.xml | sudo nc -w 5 -U /home/hts/.hts/tvheadend/epggrab/xmltv.sock

I tried the following with failure. Socat gave me the identical results as before. Channels and no shows. Curl didn't want to connect but the winner was nc, see below.

cat xmltv.xml | socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock
curl -d @xmltv.xml -X POST -m 5 --unix-socket /home/hts/.hts/tvheadend/epggrab/xmltv.sock http://google.com

cat xmltv.xml | sudo nc -w 5 -U /home/hts/.hts/tvheadend/epggrab/xmltv.sock I'd assume that was why zap2xml wasn't working because I was using socat instead of nc to import the xml.

edit4ever commented 4 years ago

There's a few things you need to sort. First - to run the script automatically, you can either setup a cron event to run the script or if you want to have tvheadend handle it - you have top install the grabber file. You may run into issues with a manual setup like this due to tvheadend's user permissions.

For channels to appear in tvheadend - you need to make sure you connect the channel epg source to the correct channel that is imported from the xmltv.xml file. Sometimes this doesn't happen automatically and you have to check it in the tvehadend web ui.

I've coded this version specific to LibreELEC installs - so there are inherent issues with the home directories. If you are just trying to setup a simple OTA DVR server - you can install LibrELEC and this addon - setup your recordings and you're done. If you're trying to use the Pi for other purposes - therefore installing a full OS like Raspbian - then it gets a lot more difficult to custom configure this code. It really is built as a Kodi addon for LibreELEC.

Rone777 commented 4 years ago

I have the same question sort of, I am trying to pull my epg data with Zap2xml, I just need a standalone xml file. I know how to download the channels/data with Zap2xml but turning that xml file into a usuable epg xml file is a slow process because the channel ids are long numbers etc, so I have to map them to my m3u epg-ids. Is their a easier to do this? for instance change the channel id of the xml Zap2xml creates to be the actual officall channel name? so instead of <channel id="I21.34810.zap2it.com"> it will be <channel id="AZFAMILY">

edit4ever commented 4 years ago

Try downloading the settings.xml file (just added a sample to the main repo) and putting it in the same folder as zap2epg.py Those are the only 2 files you should need. Edit the settings.xml file to fit your needs (change the zipcode, set the xtra description field to true/false, change number of days/etc) All of those settings can be changed in Kodi - so if you have a Kodi system running the way you want - configure zap2epg and then just copy your settings.xml and the zap2epg.py files to whatever location you want to run it on. Should work.

crwolff commented 4 years ago

I had zap2xml working great. Then I wiped my SD and setup a new dietpi for a server, thinking "I'll just dl a new copy of zap2xml.pl" HA! Awardspace does not exist anymore!

https://web.archive.org/web/20200426004001/http://zap2xml.awardspace.info/

edit4ever commented 4 years ago

glad you got it sorted!