Skip to content

Commit

Permalink
Merge pull request #90 from tobalan/main
Browse files Browse the repository at this point in the history
2.3.8
  • Loading branch information
krreet authored Jul 25, 2023
2 parents 69a3aa9 + 45ee2f1 commit 512b5f6
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 64 deletions.
7 changes: 5 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.jiotv" name="JioTV" version="2.3.7" provider-name="tobalan">
<addon id="plugin.video.jiotv" name="JioTV" version="2.3.8" provider-name="tobalan">
<requires>
<import addon="xbmc.python" version="3.0.0" />
<import addon="script.module.codequick" version="1.0.2" />
Expand All @@ -21,10 +21,13 @@
<platform>all</platform>
<license>MIT</license>
<forum>https://botallen.com/discord</forum>
<website>https://botallen.com</website>
<website>https://tobalan.github.io</website>
<email>kodi@botallen.com</email>
<source>https://github.com/tobalan/plugin.video.jiotv</source>
<news>
[- 2.3.8 -]
[added] support to play mpd streams

[- 2.3.7 -]
[added] fix for runtime error in channel list

Expand Down
16 changes: 16 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
[- 2.3.8 -]
[added] support to play mpd streams

[- 2.3.7 -]
[added] fix for runtime error in channel list

[- 2.3.6 -]
[added] language filter

[- 2.3.5 -]
[added] handle playback exceptions
[added] remove unused code
[added] save mobile no automatically on login
[added] added request dependency for lower version
[added] revert inputstreamhelper dependency version

[- 2.3.4 -]
[added] AAC multi-audio fix (3rd Jun 2023)
[added] Genres selection in Settings with Languages
Expand Down
38 changes: 30 additions & 8 deletions resources/lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def fltr(x):

@Route.register
def show_epg(plugin, day, channel_id):
resp = urlquick.get(CATCHUP_SRC.format(day, channel_id), max_age=-1).json()
resp = urlquick.get(CATCHUP_SRC.format(day, channel_id),
verify=False, max_age=-1).json()
epg = sorted(
resp['epg'], key=lambda show: show['startEpoch'], reverse=False)
livetext = '[COLOR red] [ LIVE ] [/COLOR]'
Expand Down Expand Up @@ -331,7 +332,7 @@ def play(plugin, channel_id, showtime=None, srno=None, programId=None, begin=Non
headers['channelid'] = str(channel_id)
headers['srno'] = str(
uuid4()) if "srno" not in rjson else rjson["srno"]
res = urlquick.post(GET_CHANNEL_URL, json=rjson,
res = urlquick.post(GET_CHANNEL_URL, json=rjson, verify=False,
headers=getChannelHeaders(), max_age=-1, raise_for_status=True)
# if res.status_code
resp = res.json()
Expand All @@ -344,13 +345,33 @@ def play(plugin, channel_id, showtime=None, srno=None, programId=None, begin=Non
uriToUse = resp.get("result", "")
qltyopt = Settings.get_string("quality")
selectionType = "adaptive"
if qltyopt == 'Manual':
isMpd = Settings.get_boolean("usempd") and resp.get("mpd", False)
# Script.log("LOGGINANIMAX", lvl=Script.INFO)
# Script.log(str(resp), lvl=Script.INFO)
if isMpd:
# is mpd url
license_headers = headers
license_headers['Content-type'] = 'application/octet-stream'
mpdnotice = Settings.get_boolean("mpdnotice")
if mpdnotice:
Script.notify("Notice!", "Using the Experimental MPD URL", icon=Script.NOTIFY_INFO)
# Script.notify("mpd url", "notice")
uriToUse = resp.get("mpd", "").get("result", "")
license_config = {
'license_server_url': resp.get("mpd", "").get("key", ""),
'headers': urlencode(license_headers),
'post_data': 'H{SSM}',
'response_data': ''
}
if qltyopt == 'Ask-me':
selectionType = "ask-quality"
else:
if qltyopt == 'Manual':
selectionType = "manual-osd"
if not isMpd and not qltyopt == 'Manual':
m3u8Headers = {}
m3u8Headers['user-agent'] = headers['user-agent']
m3u8Headers['cookie'] = cookie
m3u8Res = urlquick.get(uriToUse, headers=m3u8Headers,
m3u8Res = urlquick.get(uriToUse, headers=m3u8Headers, verify=False,
max_age=-1, raise_for_status=True)
# Script.notify("m3u8url", m3u8Res.status_code)
m3u8String = m3u8Res.text
Expand All @@ -373,15 +394,16 @@ def play(plugin, channel_id, showtime=None, srno=None, programId=None, begin=Non
return Listitem().from_dict(**{
"label": plugin._title,
"art": art,
"callback": uriToUse,
"callback": uriToUse+"|verifypeer=false",
"properties": {
"IsPlayable": True,
"inputstream": "inputstream.adaptive",
'inputstream.adaptive.stream_selection_type': selectionType,
"inputstream.adaptive.chooser_resolution_secure_max": "4K",
"inputstream.adaptive.manifest_headers": urlencode(headers),
"inputstream.adaptive.manifest_type": "hls",
"inputstream.adaptive.license_key": "|" + urlencode(headers) + "|R{SSM}|",
"inputstream.adaptive.manifest_type": "mpd" if isMpd else "hls",
"inputstream.adaptive.license_type": 'com.widevine.alpha',
"inputstream.adaptive.license_key": '|'.join(license_config.values()) if isMpd else "|" + urlencode(headers) + "|R{SSM}|",
}
})
except Exception as e:
Expand Down
25 changes: 15 additions & 10 deletions resources/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,27 +174,30 @@ def getCachedChannels():
channelList = db.get("channelList", False)
if not channelList:
try:
channelListResp = urlquick.get(CHANNELS_SRC).json().get("result")
channelListResp = urlquick.get(
CHANNELS_SRC, verify=False).json().get("result")
db["channelList"] = channelListResp
except:
Script.notify("Connection error ", "Retry after sometime")
return db.get("channelList", False)



def getCachedDictionary():
with PersistentDict("localdb") as db:
dictionary = db.get("dictionary", False)
if not dictionary:
try:
r = urlquick.get(DICTIONARY_URL).text.encode(
r = urlquick.get(DICTIONARY_URL, verify=False).text.encode(
'utf8')[3:].decode('utf8')
db["dictionary"] = json.loads(r)
except:
Script.notify("Connection error ", "Retry after sometime")
return db.get("dictionary", False)



def getFeatured():
try:
resp = urlquick.get(FEATURED_SRC, headers={
resp = urlquick.get(FEATURED_SRC, verify=False, headers={
"usergroup": "tvYR7NSNn7rymo3F",
"os": "android",
"devicetype": "phone",
Expand All @@ -203,7 +206,8 @@ def getFeatured():
return resp.get("featuredNewData", [])
except:
Script.notify("Connection error ", "Retry after sometime")



def cleanLocalCache():
try:
with PersistentDict("localdb") as db:
Expand Down Expand Up @@ -279,10 +283,11 @@ def quality_to_enum(quality_str, arr_len):
"""Converts quality into a numeric value. Max clips to fall within valid bounds."""
mapping = {
'Best': arr_len-1,
'High': 4,
'Medium+': 3,
'Medium': 2,
'Low': 1,
'High': max(arr_len-2, arr_len-3),
'Medium+': max(arr_len-3, arr_len-4),
'Medium': max(2, arr_len-3),
'Low': min(2, arr_len-3),
'Lower': 1,
'Lowest': 0,
}
if quality_str in mapping:
Expand Down
108 changes: 64 additions & 44 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,55 +1,75 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="Setup">
<setting id="quality" type="labelenum" label="Stream Quality" values="Manual|Best|High|Medium+|Medium|Low|Lowest" default="Best"/>
<setting id="cleanup" type="action" label="Clear Cache" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/cleanup/)" option="close"/>
<setting label="Setup Simple IPTV PVR" type="action" id="pvrsetup" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/pvrsetup/)" option="close"/>
<setting id="m3ugen" type="bool" label="Generate Playlist On Startup" default="false"/>
<setting id="channelsrc" type="bool" label="Channel API 3.0" default="false"/>
<setting id="epgsource" type="text" label="EPG Source" default="https://tobalan.github.io/epg.xml.gz"/>
<setting id="applyAllSettings1" type="action" label="Apply all settings" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)" option="close"/>
<setting id="quality" type="select" label="Stream Quality"
values="Manual|Ask-me|Best|High|Medium+|Medium|Low|Lower|Lowest" default="Best" />
<setting id="cleanup" type="action" label="Clear Cache"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/cleanup/)"
option="close" />
<setting label="Setup Simple IPTV PVR" type="action" id="pvrsetup"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/pvrsetup/)"
option="close" />
<setting id="m3ugen" type="bool" label="Generate Playlist On Startup" default="false" />
<setting id="channelsrc" type="bool" label="Use the Channel API 3.0" default="false" />
<setting id="usempd" type="bool" label="Enable MPEG-DASH (MPD) stream if available (Experimental)" default="false" />
<setting id="mpdnotice" type="bool" label="Enable the MPD URL notice" default="true" />
<setting id="epgsource" type="text" label="EPG Source"
default="https://tobalan.github.io/epg.xml.gz" />
<setting id="applyAllSettings1" type="action" label="Apply all settings"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)"
option="close" />
</category>
<category label="Genres">
<setting id="Entertainment" type="bool" label="Entertainment" default="true"/>
<setting id="Lifestyle" type="bool" label="Lifestyle" default="true"/>
<setting id="Infotainment" type="bool" label="Infotainment" default="true"/>
<setting id="Devotional" type="bool" label="Devotional" default="true"/>
<setting id="Jio Darshan" type="bool" label="Jio Darshan" default="true"/>
<setting id="News" type="bool" label="News" default="true"/>
<setting id="Business News" type="bool" label="Business News" default="true"/>
<setting id="Movies" type="bool" label="Movies" default="true"/>
<setting id="Music" type="bool" label="Music" default="true"/>
<setting id="Educational" type="bool" label="Educational" default="true"/>
<setting id="Kids" type="bool" label="Kids" default="true"/>
<setting id="Shopping" type="bool" label="Shopping" default="true"/>
<setting id="Sports" type="bool" label="Sports" default="true"/>
<setting id="applyAllSettings3" type="action" label="Apply all settings" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)" option="close"/>
<setting id="Entertainment" type="bool" label="Entertainment" default="true" />
<setting id="Lifestyle" type="bool" label="Lifestyle" default="true" />
<setting id="Infotainment" type="bool" label="Infotainment" default="true" />
<setting id="Devotional" type="bool" label="Devotional" default="true" />
<setting id="Jio Darshan" type="bool" label="Jio Darshan" default="true" />
<setting id="News" type="bool" label="News" default="true" />
<setting id="Business News" type="bool" label="Business News" default="true" />
<setting id="Movies" type="bool" label="Movies" default="true" />
<setting id="Music" type="bool" label="Music" default="true" />
<setting id="Educational" type="bool" label="Educational" default="true" />
<setting id="Kids" type="bool" label="Kids" default="true" />
<setting id="Shopping" type="bool" label="Shopping" default="true" />
<setting id="Sports" type="bool" label="Sports" default="true" />
<setting id="applyAllSettings3" type="action" label="Apply all settings"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)"
option="close" />
</category>
<category label="Languages">
<setting id="Hindi" type="bool" label="Hindi" default="true"/>
<setting id="English" type="bool" label="English" default="true"/>
<setting id="Marathi" type="bool" label="Marathi" default="true"/>
<setting id="Telugu" type="bool" label="Telugu" default="true"/>
<setting id="Kannada" type="bool" label="Kannada" default="true"/>
<setting id="Tamil" type="bool" label="Tamil" default="true"/>
<setting id="Punjabi" type="bool" label="Punjabi" default="true"/>
<setting id="Gujarati" type="bool" label="Gujarati" default="true"/>
<setting id="Bengali" type="bool" label="Bengali" default="true"/>
<setting id="Bhojpuri" type="bool" label="Bhojpuri" default="true"/>
<setting id="Malayalam" type="bool" label="Malayalam" default="true"/>
<setting id="Odia" type="bool" label="Odia" default="true"/>
<setting id="Assamese" type="bool" label="Assamese" default="true"/>
<setting id="Urdu" type="bool" label="Urdu" default="true"/>
<setting id="Nepali" type="bool" label="Nepali" default="true"/>
<setting id="Extra" type="bool" label="Extra" default="true"/>
<setting id="applyAllSettings2" type="action" label="Apply all settings" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)" option="close"/>
<setting id="Hindi" type="bool" label="Hindi" default="true" />
<setting id="English" type="bool" label="English" default="true" />
<setting id="Marathi" type="bool" label="Marathi" default="true" />
<setting id="Telugu" type="bool" label="Telugu" default="true" />
<setting id="Kannada" type="bool" label="Kannada" default="true" />
<setting id="Tamil" type="bool" label="Tamil" default="true" />
<setting id="Punjabi" type="bool" label="Punjabi" default="true" />
<setting id="Gujarati" type="bool" label="Gujarati" default="true" />
<setting id="Bengali" type="bool" label="Bengali" default="true" />
<setting id="Bhojpuri" type="bool" label="Bhojpuri" default="true" />
<setting id="Malayalam" type="bool" label="Malayalam" default="true" />
<setting id="Odia" type="bool" label="Odia" default="true" />
<setting id="Assamese" type="bool" label="Assamese" default="true" />
<setting id="Urdu" type="bool" label="Urdu" default="true" />
<setting id="Nepali" type="bool" label="Nepali" default="true" />
<setting id="Extra" type="bool" label="Extra" default="true" />
<setting id="applyAllSettings2" type="action" label="Apply all settings"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)"
option="close" />
</category>
<category label="Account">
<setting id="login" type="action" label="Login" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/login/)" option="close"/>
<setting id="logout" type="action" label="Logout" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/logout/)" option="close"/>
<setting id="setMobile" type="action" label="Update Jio number" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/setmobile/)" option="close"/>
<setting id="mobile" type="text" label="Jio number"/>
<setting id="applyAllSettings0" type="action" label="Apply all settings" action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)" option="close"/>
<setting id="login" type="action" label="Login"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/login/)" option="close" />
<setting id="logout" type="action" label="Logout"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/logout/)"
option="close" />
<setting id="setMobile" type="action" label="Update Jio number"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/setmobile/)"
option="close" />
<setting id="mobile" type="text" label="Jio number" />
<setting id="applyAllSettings0" type="action" label="Apply all settings"
action="RunPlugin(plugin://plugin.video.jiotv/resources/lib/main/applyall/)"
option="close" />
</category>
</settings>

0 comments on commit 512b5f6

Please sign in to comment.