Recent Changes - Search:

LiveStreamsPro

PmWiki

pmwiki.org

edit SideBar

EPG

Since version 2.9.6 you can use a regular regex block or python block inside the optional <channels_info> or <items_info> tags to get an EPG page from some site. It is stored in a local file in the addon user folder. This is optional but recommended to avoid repeated download of the epg data for each item. Then you can use the stored epg data with a regex block or python block for the items.

Example code for storing epg data:

<items_info>
<title>WILMAA TV</title>
<description>Swiss IPTV</description>
<thumbnail>https://lh3.googleusercontent.com/yjI46dGkmu4zFVFPUazpOgJeq3ZFg8yp6a5loJENzDtBhzVuY_VEJl1Fk0FeJYTecg=s360-rw</thumbnail>
<epg>$doregex[page_epg]</epg>
<epg_regex>
<name>page_epg</name>
<expres><![CDATA[#$pyFunction
import requests, json
from datetime import datetime

def GetLSProData(page_data,Cookie_Jar,m,param='Param1Value'):
   t1 = datetime.utcnow().strftime('%Y/%m/%d')
   url = 'http://data.wilmaa.com/cal/%s/epg_json/all_epg_utc_day_5to5_v2.json'%t1
   resp = requests.get(url, headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'})
   js = resp.json()
   return js
]]></expres>
<page></page>
</epg_regex>
</items_info>


Use an empty <epg> tag to start the epg definition. If you define a <epg_url> tag inside <epg>, a basic regex is taken from <epg_regex> and applied to the data retrieved from <epg_url> and the result appended to the item name.

If you use '$doregex' inside <epg>, you can define a custom python block or regex inside <epg_regex>. If the <page> tag is empty it will use the epg generated in <items_info> and apply the regex to the saved epg data. If <page> is defined, it will get the epg data from the url and apply the regex. The result epg is added to the item plot.

Example code for epg with python block using stored epg data:

<item>
<title>Al Jazeera English</title>
<link>link_to_stream</link>
<thumbnail>http://resources.wilmaa.com/logos/360x120px/images/ai_jazeera_en.png</thumbnail>
<epg>$doregex[epgregex]</epg>
<epg_url></epg_url>
<epg_regex>
<name>epgregex</name>
<expres><![CDATA[#$pyFunction
from datetime import datetime
import re, time

def GetLSProData(page_data,Cookie_Jar,m,param='ai_jazeera_en'):
   data = open(page_data, 'r').read()
   sched = re.findall(r'%s\|(\d{10})\|(\d{10})\|(.*?)\|'%param, data)
   epg = ''
   ts = int(time.time())
   for s in sched:
       if int(s[0]) >= ts:
           startt = datetime.fromtimestamp(int(s[0]))
           startts = startt.strftime('%H:%M')
           endt = datetime.fromtimestamp(int(s[1]))
           endts = endt.strftime('%H:%M')
           prog = s[2].encode('utf8')
           epg += "%s - %s    %s\n\r"%(startts, endts, prog)

   return epg
]]></expres>
<page></page>
</epg_regex>
</item>


Alternatively, you can store static epg inside the <epg> tags and they will be appended to the item name.

Example code:

<item>
<title>Al Jazeera English</title>
<link>link_to_stream</link>
<thumbnail>http://resources.wilmaa.com/logos/360x120px/images/ai_jazeera_en.png</thumbnail>
<epg>11:00 - 12:00 International news</epg>
<epg_url></epg_url>
</item>
Edit - History - Print - Recent Changes - Search
Page last modified on August 27, 2020, at 02:41 PM
Free Web Hosting