Skip to content

Commit

Permalink
v.0.5.3o
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Sep 12, 2024
1 parent 252b9b3 commit 700018f
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 111 deletions.
4 changes: 2 additions & 2 deletions addons.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addons>
<addon id="plugin.video.pseudotv.live" version="0.5.3n" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.3o" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="pvr.iptvsimple" version="21.8.0"/>
Expand Down Expand Up @@ -76,7 +76,7 @@
<source>https://github.com/PseudoTV/PseudoTV_Live</source>
<forum>https://forum.kodi.tv/showthread.php?tid=355549</forum>
<disclaimer lang="en_GB">BETA PROJECT; SUBJECT TO BUGS</disclaimer>
<reuselanguageinvoker>true</reuselanguageinvoker>
<reuselanguageinvoker>false</reuselanguageinvoker>
<assets>
<icon>resources/images/icon.png</icon>
<fanart>resources/images/fanart.jpg</fanart>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b24351467aaaa13b1333e1eea6dbaf61
672495a34f66a8ba4083f5bde9099a06
4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.pseudotv.live" version="0.5.3n" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.3o" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="pvr.iptvsimple" version="21.8.0"/>
Expand Down Expand Up @@ -75,7 +75,7 @@
<source>https://github.com/PseudoTV/PseudoTV_Live</source>
<forum>https://forum.kodi.tv/showthread.php?tid=355549</forum>
<disclaimer lang="en_GB">BETA PROJECT; SUBJECT TO BUGS</disclaimer>
<reuselanguageinvoker>true</reuselanguageinvoker>
<reuselanguageinvoker>false</reuselanguageinvoker>
<assets>
<icon>resources/images/icon.png</icon>
<fanart>resources/images/fanart.jpg</fanart>
Expand Down
3 changes: 2 additions & 1 deletion plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
v.0.5.4
-Refactored Playback:
-Improved Playlist/Broadcast/VOD callbacks and handling.
-New! EPG (Guide) behavior: Play media from any position regardless of playback type.
-New! EPG (Guide) behavior: Play media as VOD from any position regardless of playback type.
-"Play Programme" context will launch continued playback if enabled in Kodi's LiveTV Settings.
-New! On VOD finish channel will resume in realtime.
-Added "Build Filler Subfolders" setting to "Fillers".
-Added "Bonjour on startup" setting to "Multi-Room".
Expand Down
4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def buildList(self, citem: dict, path: str, media: str='video', page: int=SETTIN
self.log("buildList, id: %s, IDX = %s skipping 3D file! file = %s"%(citem['id'],idx,file),xbmc.LOGINFO)
continue

dur = self.jsonRPC.getDuration(file, item, self.accurateDuration, self.saveDuration, self.minDuration)
dur = self.jsonRPC.getDuration(file, item, self.accurateDuration, self.saveDuration)
if dur > self.minDuration: #include media that's duration is above the players seek tolerance & users adv. rule.
item['duration'] = dur
item['media'] = media
Expand Down Expand Up @@ -450,7 +450,7 @@ def addChannelStation(self, citem: dict) -> bool:
self.log('addChannelStation, id: %s'%(citem['id']))
if citem['catchup']:
citem['url'] = LIVE_URL.format(addon=ADDON_ID,name=quoteString(citem['name']),chid=quoteString(citem['id']),vid='{catchup-id}',now='{lutc}',start='{utc}',duration='{duration}',stop='{utcend}')
citem['catchup-source'] = BROADCAST_URL.format(addon=ADDON_ID,name=quoteString(citem['name']),chid=quoteString(citem['id']),vid='{catchup-id}',now='{lutc}',start='{utc}',duration='{duration}',stop='{utcend}')
citem['catchup-source'] = BROADCAST_URL.format(addon=ADDON_ID,name=quoteString(citem['name']),chid=quoteString(citem['id']),vid='{catchup-id}')
elif citem['radio']:
citem['url'] = RADIO_URL.format(addon=ADDON_ID,name=quoteString(citem['name']),chid=quoteString(citem['id']),radio=str(citem['radio']),vid='{catchup-id}')
else:
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def getTemplate(self) -> dict:


def getChannels(self) -> list:
return self.channelDATA.get('channels',[])
return sorted(self.channelDATA['channels'], key=itemgetter('number'))


def popChannels(self, type: str, channels: list=[]) -> list:
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@
">": "&gt;",
"<": "&lt;"}

DVR_URL = 'plugin://{addon}/?mode=dvr&title={title}&chid={chid}&vid={vid}&seek={seek}&duration={duration}.pvr'
VOD_URL = 'plugin://{addon}/?mode=vod&title={title}&chid={chid}&vid={vid}&name={name}.pvr'
TV_URL = 'plugin://{addon}/?mode=tv&name={name}&chid={chid}.pvr'
RADIO_URL = 'plugin://{addon}/?mode=radio&name={name}&chid={chid}&radio={radio}&vid={vid}.pvr'
LIVE_URL = 'plugin://{addon}/?mode=live&name={name}&chid={chid}&vid={vid}&now={now}&start={start}&duration={duration}&stop={stop}.pvr'
BROADCAST_URL = 'plugin://{addon}/?mode=broadcast&name={name}&chid={chid}&vid={vid}&now={now}&start={start}&duration={duration}&stop={stop}.pvr'
BROADCAST_URL = 'plugin://{addon}/?mode=broadcast&name={name}&chid={chid}&vid={vid}.pvr'
VOD_URL = 'plugin://{addon}/?mode=vod&title={title}&chid={chid}&vid={vid}&name={name}.pvr'
DVR_URL = 'plugin://{addon}/?mode=dvr&title={title}&chid={chid}&vid={vid}&seek={seek}&duration={duration}.pvr'

PTVL_REPO = 'repository.pseudotv'
PVR_CLIENT_ID = 'pvr.iptvsimple'
Expand Down
4 changes: 1 addition & 3 deletions plugin.video.pseudotv.live/resources/lib/context_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def add(self):
def open(self):
if not PROPERTIES.isRunning('MANAGER_RUNNING'):
with PROPERTIES.setRunning('MANAGER_RUNNING'), BUILTIN.busy_dialog(), PROPERTIES.suspendActivity():
chnum = self.fitem.get('citem',{}).get('number',1)
if chnum > CHANNEL_LIMIT: chnum = 1
manager = Manager("%s.manager.xml"%(ADDON_ID), ADDON_PATH, "default", channel=chnum)
manager = Manager("%s.manager.xml"%(ADDON_ID), ADDON_PATH, "default", channel=self.fitem.get('citem',{}).get('number',1))
del manager


Expand Down
20 changes: 5 additions & 15 deletions plugin.video.pseudotv.live/resources/lib/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,14 @@
def run(sysARG, fitem: dict={}, nitem: dict={}):
params = dict(urllib.parse.parse_qsl(sysARG[2][1:].replace('.pvr','')))
mode = (params.get("mode") or 'guide')
log("Default: run, In params = %s"%(params))
params['fitem'] = fitem
params['nitem'] = nitem
params["chid"] = (params.get("chid") or fitem.get('citem',{}).get('id'))
params['vid'] = (decodeString(params.get("vid",'') or None))
params['citem'] = combineDicts({'id':params["chid"]},fitem.get('citem',{}))
params['name'] = (unquoteString(params.get("name",'')) or BUILTIN.getInfoLabel('ChannelName'))
params['title'] = (unquoteString(params.get("title",'')) or BUILTIN.getInfoLabel('label'))
params['radio'] = (params.get("radio") or 'False').lower() == "true"
params['playcount'] = 0
params['now'] = int(params.get('now') or getUTCstamp())
params['duration'] = int(params.get('duration') or timeString2Seconds(BUILTIN.getInfoLabel('Duration(hh:mm:ss)')) or '0')
params['progress'] = (int(BUILTIN.getInfoLabel('Progress') or '0'),int(BUILTIN.getInfoLabel('PercentPlayed') or '0'))
params['chnumlabel'] = BUILTIN.getInfoLabel('ChannelNumberLabel')
params['chpath'] = BUILTIN.getInfoLabel('FileNameAndPath')
params['isLinear'] = True if mode == 'live' else False
params['vid'] = decodeString(params.get("vid",''))
params['title'] = (params.get('title') or BUILTIN.getInfoLabel('label'))
params['name'] = (unquoteString(params.get("name",'')) or BUILTIN.getInfoLabel('ChannelName'))
params["chid"] = params.get("chid")
params['isPlaylist'] = bool(SETTINGS.getSettingInt('Playback_Method'))
log("Default: run, Out params = %s"%(params))
log("Default: run, params = %s"%(params))

if mode == 'guide':
hasAddon(PVR_CLIENT_ID,install=True,enable=True)
Expand Down
24 changes: 14 additions & 10 deletions plugin.video.pseudotv.live/resources/lib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,29 +296,29 @@ def setDuration(self, path, item={}, runtime=0, save=SETTINGS.getSettingBool('St
if save and not path.startswith(tuple(VFS_TYPES)): self.queDuration(item, runtime)


def getDuration(self, path, item={}, accurate=bool(SETTINGS.getSettingInt('Duration_Type')), save=SETTINGS.getSettingBool('Store_Duration'), offset=SETTINGS.getSettingInt('Seek_Tolerance')):
self.log("getDuration, accurate = %s, path = %s, save = %s, offset = -%s" % (accurate, path, save, offset))
def getRuntime(self, item={}):
return (item.get('resume',{}).get('total') or item.get('runtime') or item.get('duration') or (item.get('streamdetails',{}).get('video',[]) or [{}])[0].get('duration'))


def getDuration(self, path, item={}, accurate=bool(SETTINGS.getSettingInt('Duration_Type')), save=SETTINGS.getSettingBool('Store_Duration')):
self.log("getDuration, accurate = %s, path = %s, save = %s" % (accurate, path, save))
runtime = (self.cache.get('getPlayerLength.%s'%(getMD5(path)), checksum=getMD5(path), json_data=False) or 0)
if runtime == 0:
runtime = (item.get('resume',{}).get('total') or item.get('runtime') or item.get('duration') or (item.get('streamdetails',{}).get('video',[]) or [{}])[0].get('duration') or 0)
runtime = (self.getRuntime(item) or 0)
if (runtime == 0 or accurate):
duration = 0
if isStack(path):# handle "stacked" videos
for file in splitStacks(path): duration += self.parseDuration(file)
else: duration = self.parseDuration(path, item, save)
if duration > 0: runtime = duration
if not accurate:
self.log("getDuration, applying offset = -%s" % (offset))
runtime -= offset
self.log("getDuration, returning path = %s, runtime = %s" % (path, runtime))
return runtime


def parseDuration(self, path, item={}, save=SETTINGS.getSettingBool('Store_Duration')):
self.log("parseDuration, path = %s, save = %s" % (path, save))
runtime = (item.get('resume',{}).get('total') or item.get('runtime') or item.get('duration') or (item.get('streamdetails',{}).get('video',[]) or [{}])[0].get('duration') or 0)
runtime = (self.getRuntime(item) or 0)
duration = self.videoParser.getVideoLength(path.replace("\\\\", "\\"), item, self)

if not path.startswith(tuple(VFS_TYPES)):
## duration diff. safe guard, how different are the two values? if > 45% don't save to Kodi.
rundiff = int(percentDiff(runtime, duration))
Expand Down Expand Up @@ -544,7 +544,11 @@ def _matchJSON():#requires 'pvr://' json whitelisting.
if item.get('label','').lower() == sysInfo.get('name','').lower() and decodePlot(item.get('plot','')).get('citem',{}).get('id') == sysInfo.get('chid'):
self.log('getCallback: _matchJSON, id = %s, found file = %s'%(sysInfo.get('chid'),item.get('file')))
return item.get('file')
callback = _matchJSON()

if sysInfo.get('mode').lower() == 'live' and sysInfo.get('chpath'): callback = sysInfo.get('chpath')
else: callback = _matchJSON()
self.log('getCallback: returning callback = %s'%(callback))
return callback




14 changes: 11 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ def __init__(self, *args, **kwargs):
self.newChannels = self.channelList.copy()

self.startChannel = kwargs.get('channel',-1)
if self.startChannel == -1: self.startChannel = self.getFirstAvailChannel()
self.focusIndex = (self.startChannel - 1) #Convert from Channel number to array index
if self.startChannel == -1: self.startChannel = self.getFirstAvailChannel()
if self.startChannel <= CHANNEL_LIMIT: self.focusIndex = (self.startChannel - 1) #Convert from Channel number to array index
else: self.focusIndex = self.findChannelIDXbyNum(self.startChannel)
self.log('Manager, startChannel = %s, focusIndex = %s'%(self.startChannel, self.focusIndex))

try:
Expand Down Expand Up @@ -895,4 +896,11 @@ def onClick(self, controlId):
elif controlId == 9003: #dynamic button
if focusItems['label'] == LANGUAGE(32136):self.moveChannel(focusItems.get('citem'),focusItems.get('position'))#Move
elif controlId == 9004: #dynamic button
if focusItems['label'] == LANGUAGE(32061): self.clearChannel(focusItems.get('citem'))#Delete
if focusItems['label'] == LANGUAGE(32061): self.clearChannel(focusItems.get('citem'))#Delete


def findChannelIDXbyNum(self, chnum, channels=[]):
if not channels: channels = self.channelList
for idx, channel in enumerate(channels):
if channel.get('number') == chnum: return idx
return 1
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ def determineLength(self, filename: str) -> int and float:
log('YTParser: Duration is %s'%(dur))
return dur
except Exception as e:
log("YTParser: failed!", xbmc.LOGERROR)
# log("YTParser: failed!", xbmc.LOGERROR)
return 0
Loading

0 comments on commit 700018f

Please sign in to comment.