LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 September 8 2016

ChadiM
Member

Lebanese channels on Kodi for expats

Hey geeks.

I wrote a python tool that provides Lebanese channel list and (limited) EPG and can be used as input for Kodi's IPTV Simple plugin.

I use it to watch Lebanese channels in France on a Raspberry PI connected to my TV.

The code is on GitHub, in case someone is interested: https://github.com/ChadiEM/Lebanese-Channels
Check the Readme for a screenshot.

Update:

On debian-based systems, run the below:
# apt-get install python3 python3-pip
# python3 -m pip install flask flask_caching gunicorn BeautifulSoup4 lxml

Last edited by ChadiM (March 6 2017)

Offline

#2 September 9 2016

elserge82
Member

Re: Lebanese channels on Kodi for expats

Cool will surely try it:)

Offline

#3 September 9 2016

Adnan
Member

Re: Lebanese channels on Kodi for expats

It doesn't work because my python is 2.7. For python 3 I need to run the python3 command. I shebanged the included python files but apparently the gunicorn in the start.sh needs to be run in python3 too. Do you know how can I do that? I'm on Debian.

Last edited by Adnan (September 9 2016)

Offline

#4 September 10 2016

ChadiM
Member

Re: Lebanese channels on Kodi for expats

Adnan wrote:

It doesn't work because my python is 2.7. For python 3 I need to run the python3 command. I shebanged the included python files but apparently the gunicorn in the start.sh needs to be run in python3 too. Do you know how can I do that? I'm on Debian.

Thanks for your feedback Adnan!

That's what I get on my system:

chadi@chadi-desktop:~$ which gunicorn
/usr/local/bin/gunicorn
chadi@chadi-desktop:~$ cat /usr/local/bin/gunicorn
#!/usr/bin/python3

# -*- coding: utf-8 -*-
import re
import sys

from gunicorn.app.wsgiapp import run

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(run())

I pushed a fix to force python3, can you please pull the changes and let me know if it works?

Initial post updated with instructions for debian based systems.

Last edited by ChadiM (September 10 2016)

Offline

#5 September 14 2016

Adnan
Member

Re: Lebanese channels on Kodi for expats

Thanks, it's running now. But I'm still unable to set it up on Kodi. I've set everything as it should be in the settings. But how do I access the channels now? I can't see any TV category in the main menu.

Offline

#6 September 17 2016

ChadiM
Member

Re: Lebanese channels on Kodi for expats

Adnan wrote:

Thanks, it's running now. But I'm still unable to set it up on Kodi. I've set everything as it should be in the settings. But how do I access the channels now? I can't see any TV category in the main menu.

You need the IPTV Simple PVR addon.

apt-get install kodi-pvr-iptvsimple

Offline

#7 September 20 2016

chaosn
Member

Re: Lebanese channels on Kodi for expats

I installed per the instruction.  I was able to get everything set up properly using Ubuntu 16.04 (Xenial).  My setup differs  in 4 ways, but I don’t think any are relevant.  But as extra info:

1)      I’m using Aeon Nox 5 as my skin (with LiveTV Mod) – not Confluence.  However I don’t think this should matter?

2)      I don’t have Arabic fonts installed on Kodi.  I realize this means the program titles won’t display properly, but it shouldn’t matter for tuning a channel right?

3)      I installed the python scripts to a local server on my network and then stream from there to Kodi over my LAN, rather than on localhost.  This is because python3 is not available on LibreELEC.  I would think this would be fine.  I modified the URLs in the IPTV PVR client accordingly.

4)      I modified the starting ID number to 100 rather than 1 in channel_ids.py.  This is because I have an existing EPG and I don’t want conflicts with channel numbers.  The IPTV PVR client does not seem to honor the “start numbering at” directive in the config settings, so I had to do it like this.

(Even without the mod in #4, the below observations were true)

The observed behavior is that I can download the channel names and logos, and they show up on the EPG fine.  However, no EPG program data shows up and none of the channels except the three “Nour” channels tune.  I click the channel to tune it, and nothing happens.  One time, I got program names and times for a few channels in the channel list view (can’t tell what they say due to no Arabic fonts) but still can’t tune.  The EPG time grid still did not show any TV shows in their proper times – just “No Info Available.”

I can’t figure out what or where any debug logging on the server is output by the scripts in order to help troubleshoot, so I am asking for help.

Offline

#8 September 20 2016

xterm
Moderator

Re: Lebanese channels on Kodi for expats

Nicely done ChadiM!

Offline

#9 September 21 2016

ChadiM
Member

Re: Lebanese channels on Kodi for expats

First, thanks for your feedback!

chaosn wrote:

1)      I’m using Aeon Nox 5 as my skin (with LiveTV Mod) – not Confluence.  However I don’t think this should matter?

I don't think so, but I can't tell for sure - I only used Confluence.

chaosn wrote:

2)      I don’t have Arabic fonts installed on Kodi.  I realize this means the program titles won’t display properly, but it shouldn’t matter for tuning a channel right?

Thanks for mentioning it. Indeed, you need to change your fonts to Arial based to be able to see Arabic characters. To do so, go to System > Appearance > Skin, and under Fonts, change Skin default to Arial based. I'll add that to the list of required things to do.

chaosn wrote:

3)      I installed the python scripts to a local server on my network and then stream from there to Kodi over my LAN, rather than on localhost.  This is because python3 is not available on LibreELEC.  I would think this would be fine.  I modified the URLs in the IPTV PVR client accordingly.

That should be fine. Just make sure to change the URLs in flaskapp.py (it was enhanced to use the hostname to avoid this manipulation in this commit, make sure to get it). To check, you can verify from a browser:

http://<host>:12589/epg

http://<host>:12589/channels

Then pick one channel, and test it; for example:

http://<host>:12589/channel/lbc



Where do you live, by the way?

Last edited by ChadiM (September 21 2016)

Offline

#10 September 22 2016

chaosn
Member

Re: Lebanese channels on Kodi for expats

Hey Chadi,

First I would like to thank you for the tutorial.

Actually I live In Lebanon, but it is for my sister and brother in law who lives in the US, so I m going through this with them to set it up. They will be really appreciated if this works.

Keep up with the good work..

Offline

#11 September 22 2016

ChadiM
Member

Re: Lebanese channels on Kodi for expats

chaosn wrote:

Hey Chadi,

First I would like to thank you for the tutorial.

Actually I live In Lebanon, but it is for my sister and brother in law who lives in the US, so I m going through this with them to set it up. They will be really appreciated if this works.

Keep up with the good work..

I asked because I only tested this in France, and I know that some channels might be blocked in specific countries. I don't know about the US. I might need to try with a proxy.

Edit: LBC and MTV are blocked in the US. There is nothing I can do about it...
Edit2: If you take the latest changes, http://<hostname>/channels/us and http://<hostname>/epg/us to hide the US blocked channels.

Last edited by ChadiM (October 12 2016)

Offline

Board footer