Skip to content

Commit 17347fa

Browse files
authored
Merge pull request #57 from krreet/feature/support-for-catchup
added own epg , play live show catchup
2 parents 5f81161 + 67e134a commit 17347fa

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

resources/lib/constants.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@
1313
PLAY_URL = "plugin://plugin.video.jiotv/resources/lib/main/play/?"
1414
PLAY_EX_URL = "plugin://plugin.video.jiotv/resources/lib/main/play_ex/?_pickle_="
1515
FEATURED_SRC = "https://tv.media.jio.com/apis/v1.6/getdata/featurednew?start=0&limit=30&langId=6"
16-
CHANNELS_SRC_NEW = "https://jiotv.data.cdn.jio.com/apis/v3.0/getMobileChannelList/get/?langId=6&os=android&devicetype=phone&usertype=tvYR7NSNn7rymo3F&version=285&langId=6"
17-
CHANNELS_SRC = "https://jiotv.data.cdn.jio.com/apis/v1.3/getMobileChannelList/get/?os=android&devicetype=phone&usertype=JIO&version=290&langId=6" if Settings.get_boolean("channelsrc") else CHANNELS_SRC_NEW
16+
CHANNELS_SRC_NEW = "https://jiotv.data.cdn.jio.com/apis/v3.0/getMobileChannelList/get/?langId=6&os=android&devicetype=phone&usertype=tvYR7NSNn7rymo3F&version=285"
17+
CHANNELS_SRC = CHANNELS_SRC_NEW if Settings.get_boolean(
18+
"channelsrc") else "https://jiotv.data.cdn.jio.com/apis/v1.3/getMobileChannelList/get/?os=android&devicetype=phone&usertype=JIO&version=290&langId=6"
1819
GET_CHANNEL_URL = "https://tv.media.jio.com/apis/v2.0/getchannelurl/getchannelurl?langId=6&userLanguages=All"
1920
CATCHUP_SRC = "https://jiotv.data.cdn.jio.com/apis/v1.3/getepg/get?offset={0}&channel_id={1}&langId=6"
2021
M3U_SRC = os.path.join(translatePath(
2122
ADDON.getAddonInfo("profile")), "playlist.m3u")
2223
EPG_PATH = os.path.join(translatePath(
2324
ADDON.getAddonInfo("profile")), "jiotv-epg.xml.gz")
2425
M3U_CHANNEL = "\n#EXTINF:0 tvg-id=\"{tvg_id}\" tvg-name=\"{channel_name}\" group-title=\"{group_title}\" tvg-chno=\"{tvg_chno}\" tvg-logo=\"{tvg_logo}\"{catchup},{channel_name}\n{play_url}"
25-
EPG_SRC = "https://kodi.botallen.com/tv/epg.xml.gz"
26+
# EPG_SRC = "https://kodi.botallen.com/tv/epg.xml.gz"
27+
EPG_SRC = "https://cdn.jsdelivr.net/gh/krreet/epg/python/epg.xml.gz"
2628
DICTIONARY_URL = "https://jiotvapi.cdn.jio.com/apis/v1.3/dictionary/dictionary?langId=6"
27-
# CHANNELS_XML = os.path.join(translatePath(ADDON.getAddonInfo("path")), "resources", "channels.xml")
2829

2930
IMG_CONFIG = {
3031
"Genres": {

resources/lib/main.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ def show_epg(plugin, day, channel_id):
247247
},
248248
"params": {
249249
"channel_id": each.get("channel_id"),
250-
"showtime": None if islive else each.get("showtime", "").replace(":", ""),
251-
"srno": None if islive else datetime.fromtimestamp(int(each.get("startEpoch", 0)*.001)).strftime('%Y%m%d'),
252-
"programId": None if islive else each.get("srno", ""),
253-
"begin": None if islive else datetime.utcfromtimestamp(int(each.get("startEpoch", 0)*.001)).strftime('%Y%m%dT%H%M%S'),
254-
"end": None if islive else datetime.utcfromtimestamp(int(each.get("endEpoch", 0)*.001)).strftime('%Y%m%dT%H%M%S')
250+
"showtime": each.get("showtime", "").replace(":", ""),
251+
"srno": datetime.fromtimestamp(int(each.get("startEpoch", 0)*.001)).strftime('%Y%m%d'),
252+
"programId": each.get("srno", ""),
253+
"begin": datetime.utcfromtimestamp(int(each.get("startEpoch", 0)*.001)).strftime('%Y%m%dT%H%M%S'),
254+
"end": datetime.utcfromtimestamp(int(each.get("endEpoch", 0)*.001)).strftime('%Y%m%dT%H%M%S')
255255
}
256256
})
257257
if int(day) == 0:
@@ -453,15 +453,11 @@ def logout(plugin):
453453
# M3u Generate `route`
454454
@Script.register
455455
def m3ugen(plugin, notify="yes"):
456-
pDialog = DialogProgress()
457-
pDialog.create('Generating M3U')
458-
pDialog.update(20)
459456
channels = urlquick.get(CHANNELS_SRC).json().get("result")
460457
r = urlquick.get(DICTIONARY_URL).text.encode('utf8')[3:].decode('utf8')
461458
dictionary = json.loads(r)
462459
GENRE_MAP = dictionary.get("channelCategoryMapping")
463460
LANG_MAP = dictionary.get("languageIdMapping")
464-
pDialog.update(50)
465461

466462
m3ustr = "#EXTM3U x-tvg-url=\"%s\"" % EPG_SRC
467463
for i, channel in enumerate(channels):
@@ -496,8 +492,6 @@ def m3ugen(plugin, notify="yes"):
496492
)
497493
with open(M3U_SRC, "w+") as f:
498494
f.write(m3ustr.replace(u'\xa0', ' ').encode('utf-8').decode('utf-8'))
499-
pDialog.update(100)
500-
pDialog.close()
501495
if notify == "yes":
502496
Script.notify(
503497
"JioTV", "Playlist updated.")
@@ -535,8 +529,8 @@ def epg_setup(plugin):
535529
# for channel in root.iterfind("channel"):
536530
# root.remove(channel)
537531
pDialog.update(35)
538-
# Example: Modify the program and add catchupid
539-
# for channel in source_root.iterfind('channel'):
532+
# Example: Modify the program and add catchupid
533+
# for channel in source_root.iterfind('channel'):
540534
# new_channel = ET.Element(channel.tag, channel.attrib)
541535
# for child in channel:
542536
# new_child = ET.Element(child.tag, child.attrib)
@@ -576,14 +570,15 @@ def pvrsetup(plugin):
576570
executebuiltin(
577571
"RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/m3ugen/)")
578572
IDdoADDON = 'pvr.iptvsimple'
573+
579574
def set_setting(id, value):
580575
if Addon(IDdoADDON).getSetting(id) != value:
581576
Addon(IDdoADDON).setSetting(id, value)
582577
if check_addon(IDdoADDON):
583578
set_setting("m3uPathType", "0")
584579
set_setting("m3uPath", M3U_SRC)
585-
set_setting("epgPathType", "0")
586-
set_setting("epgPath", EPG_PATH)
580+
set_setting("epgPathType", "1")
581+
set_setting("epgUrl", EPG_SRC)
587582
set_setting("catchupEnabled", "true")
588583
set_setting("catchupWatchEpgBeginBufferMins", "0")
589584
set_setting("catchupWatchEpgEndBufferMins", "0")

resources/settings.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
<setting id="applyAllSettings0" type="action" label="Apply all settings" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)" option="close"/>
99
</category>
1010
<category label="Setup">
11-
<setting label="EPG URL" type="text" id="epgurl" default="https://bit.ly/3kWSsl3"/>
12-
<setting id="channelsrc" type="bool" label="Channel API 1.3" default="true"/>
13-
<setting label="Setup EPG" type="action" id="epgsetup" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/epg_setup/)"/>
11+
<setting id="channelsrc" type="bool" label="Channel API 3.0" default="true"/>
1412
<setting label="Setup Simple IPTV PVR" type="action" id="pvrsetup" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/pvrsetup/)" option="close"/>
1513
<setting id="m3ugen" type="bool" label="Generate Playlist On Startup" default="true"/>
1614
<!-- <setting id="extraPl" type="text" label="Extra Playlist"/> -->

0 commit comments

Comments
 (0)