Skip to content

Commit

Permalink
v.0.5.5x
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Nov 14, 2024
1 parent f1bdb3c commit 56e2111
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 107 deletions.
2 changes: 1 addition & 1 deletion 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.5w" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5x" 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
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10180e506aead3ea6dcb65dfb674bee9
e33c37654d41a72c72169fcbf827da87
2 changes: 1 addition & 1 deletion 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.5w" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5x" 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
1 change: 1 addition & 0 deletions plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
v.0.5.6
-Fixed Overlay issues introduced in previous versions.
-Improved Vignette (W.I.P):
-Global settings added for default vignette image, zoom. Per-Channel settings available in Advanced Channel Rules.
-Improved MediaInfo support for external mediainfo.xml file parsing.
Expand Down
1 change: 1 addition & 0 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def build(self):

updated = False
for idx, citem in enumerate(channels):
self.log('build, id = %s, rules = %s'%(citem.get('id'),citem.get('rules',{})))
if self.service._interrupt():
self.completeBuild = False
self.pErrors = [LANGUAGE(32160)]
Expand Down
8 changes: 7 additions & 1 deletion plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,14 @@ def compareDict(dict1,dict2,sortKey):
b = sorted(dict2, key=itemgetter(sortKey))
return a == b

def subZoom(number,percentage,multi=100):
return round(number * (percentage*multi) / 100)

def addZoom(number,percentage,multi=100):
return round((number - (number * (percentage*multi) / 100)) + number)

def frange(start,stop,inc):
return map(lambda x: x/10.0, range(start,stop,inc))
return [x/10.0 for x in range(start,stop,inc)]

def timeString2Seconds(string): #hh:mm:ss
try: return int(sum(x*y for x, y in zip(list(map(float, string.split(':')[::-1])), (1, 60, 3600, 86400))))
Expand Down
159 changes: 85 additions & 74 deletions plugin.video.pseudotv.live/resources/lib/overlay.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def getLogoResources(self, chname: str, type: str, select: bool=False) -> dict a
resources = SETTINGS.getSetting('Resource_Logos').split('|').copy()
if type in ["TV Genres","Movie Genres"]: resources.extend(GENRE_RESOURCE)
elif type in ["TV Networks","Movie Studios"]: resources.extend(STUDIO_RESOURCE)
elif type == "Music Genres": resources.extend(MUSIC_RESOURCE)
elif type in ["Music Genres","Radio"]: resources.extend(MUSIC_RESOURCE)
else:
resources.extend(GENRE_RESOURCE)
resources.extend(STUDIO_RESOURCE)
Expand Down
17 changes: 9 additions & 8 deletions plugin.video.pseudotv.live/resources/lib/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ def __init__(self):
self.exclude = False
self.name = "Screen Vignette"
self.description = "Add Channel Overlay to create a immersive viewing experience."
self.optionLabels = ['Enable Screen Vignette','Vignette Image','Vignette Image offset']
self.optionLabels = ['Enable Screen Vignette','Vignette Image','Vignette Image offset','Vignette Image Zoom']
self.optionValues = [SETTINGS.getSettingBool('Enable_Vignette'),SETTINGS.getSetting('Vignette_Image'),"(0,0)",SETTINGS.getSettingFloat('Vignette_Zoom')]
self.optionDescriptions = ["Show Screen Vignette","Change Vignette Image","Change Vignette Offset"]
self.optionDescriptions = ["Show Screen Vignette","Change Vignette Image","Change Vignette Offset","Change Vignette Zoom"]
self.actions = [RULES_ACTION_OVERLAY_OPEN,RULES_ACTION_OVERLAY_CLOSE]
self.selectBoxOptions = [[True,False],'','',list(frange(5,21,1))]
self.storedValues = [list() for idx in self.optionValues]
Expand All @@ -416,7 +416,7 @@ def copy(self):


def getTitle(self):
if self.optionValues[0]: return 'Show Screen Vignette w/%s offset\n%s'%(self.optionValues[2],self.getImage(self.optionValues[1]))
if self.optionValues[0]: return 'Show Screen Vignette w/%s\noffset = %s, zoom = %s'%(self.getImage(self.optionValues[1]),self.optionValues[2],self.optionValues[3])
else: return 'Hide Screen Vignette'


Expand Down Expand Up @@ -470,6 +470,7 @@ def runAction(self, actionid, citem, parameter, overlay):
overlay._vinImage = self.storedValues[1]
overlay._vinOffsetXY = self.storedValues[2]
overlay._vinZoom = self.storedValues[3]

self.log("runAction, setting overlay enabled = %s, image %s @ (%s) X %s"%(overlay.enableVignette, overlay._vinImage, overlay._vinOffsetXY, overlay._vinZoom))
return parameter

Expand Down Expand Up @@ -741,14 +742,14 @@ def onAction(self, optionindex):
return self.optionValues[optionindex]


def runAction(self, actionid, citem, parameter, overlay):
def runAction(self, actionid, citem, parameter, player):
if actionid == RULES_ACTION_PLAYER_START:
self.storedValues[0] = overlay.restartPercentage
overlay.restartPercentage = self.optionValues[0]
self.storedValues[0] = player.restartPercentage
player.restartPercentage = self.optionValues[0]

elif actionid == RULES_ACTION_PLAYER_STOP:
overlay.restartPercentage = self.storedValues[0]
self.log("runAction, setting restartPercentage = %s"%(overlay.restartPercentage))
player.restartPercentage = self.storedValues[0]
self.log("runAction, setting restartPercentage = %s"%(player.restartPercentage))
return parameter


Expand Down
47 changes: 27 additions & 20 deletions plugin.video.pseudotv.live/resources/lib/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Player(xbmc.Player):
isPseudoTV = False
lastSubState = False
isIdle = False
minDuration = None
restart = None
minDuration = None
accurateDuration = None
rules = RulesList()
runActions = rules.runActions
Expand Down Expand Up @@ -107,8 +107,9 @@ def onPlayBackStopped(self):


def isPseudoTVPlaying(self):
state = loadJSON(decodeString(self.getPlayerItem().getProperty('sysInfo'))).get('chid') != None
self.log('isPseudoTVPlaying = %s'%(state))
chid = loadJSON(decodeString(self.getPlayerItem().getProperty('sysInfo'))).get('chid','')
state = '@%s'%(slugify(ADDON_NAME)) in chid
self.log('isPseudoTVPlaying = %s, id = %s'%(state,chid))
return state


Expand Down Expand Up @@ -193,9 +194,9 @@ def setRuntime(self, state: bool=SETTINGS.getSettingBool('Store_Duration'), fite


def _onPlay(self):
self.log('_onPlay')
oldInfo = self.sysInfo
self.sysInfo = self.getPlayerSysInfo() #get current sysInfo
self.log('_onPlay, id = %s, rules = %s'%(self.sysInfo.get('citem',{}).get('id'),self.sysInfo.get('rules',{})))
#items that only run once per channel change. ie. set adv. rules and variables.
if self.sysInfo.get('chid') != oldInfo.get('chid',random.random()): #playing new channel
self.runActions(RULES_ACTION_PLAYER_START, self.sysInfo.get('citem',{}), inherited=self)
Expand Down Expand Up @@ -235,7 +236,6 @@ def _onStop(self):
if self.sysInfo.get('isPlaylist'): xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
self.runActions(RULES_ACTION_PLAYER_STOP, self.sysInfo.get('citem',{}), inherited=self)
self.sysInfo = {}
self.isPseudoTV = False


def _onError(self):
Expand All @@ -249,20 +249,22 @@ def toggleInfo(self, state: bool=True):
self.log('toggleInfo, state = %s'%(state))
BUILTIN.executebuiltin('ActivateWindow(fullscreeninfo)')
timerit(self.toggleInfo)(float(SETTINGS.getSettingInt('OSD_Timer')),[False])
elif BUILTIN.getInfoBool('IsVisible(fullscreeninfo)','Window'): BUILTIN.executebuiltin('Action(back)')
elif not state and BUILTIN.getInfoBool('IsVisible(fullscreeninfo)','Window'):
BUILTIN.executebuiltin('Action(back)')


def toggleRestart(self, state: bool=True):
if state and bool(self.restartPercentage):
if BUILTIN.getInfoLabel('Genre','VideoPlayer') in FILLER_TYPE: return
progress = self.getPlayerProgress()
seekTHD = SETTINGS.getSettingInt('Seek_Threshold')
self.log('toggleRestart, progress = %s, restartPercentage = %s, seekTHD = %s'%(progress,self.restartPercentage,seekTHD))
if (progress >= self.restartPercentage and progress < seekTHD) and self.sysInfo.get('fitem'):
if not hasattr(self.restart, 'doModal'): self.restart = Restart(RESTART_XML, ADDON_PATH, "default", "1080i", player=self)
#todo apply zoom to to posxy
if self.restart is None and (progress >= self.restartPercentage and progress < seekTHD) and self.sysInfo.get('fitem'):
self.restart = Restart(RESTART_XML, ADDON_PATH, "default", "1080i", player=self)
self.log('toggleRestart, state = %s'%(state))
self.restart.doModal()
elif not state and hasattr(self.restart, 'onClose'):
self.restart = self.restart.doModal()
elif not state and hasattr(self.restart,'onClose'):
self.log('toggleRestart, state = %s'%(state))
self.restart = self.restart.onClose()

Expand Down Expand Up @@ -296,20 +298,24 @@ def getIdle(self):

def chkIdle(self):
self.isIdle, self.idleTime = self.getIdle()
if self.service.player.isPlaying() and not BUILTIN.isPaused():
if self.service.player.sleepTime > 0 and (self.idleTime > (self.service.player.sleepTime * 10800)): self.triggerSleep()
if self.isIdle: self.toggleOverlay(True)
else: self.toggleOverlay(False)
if SETTINGS.getSettingBool('Debug_Enable'):
self.log('chkIdle, isIdle = %s, idleTime = %s'%(self.isIdle, self.idleTime))
if self.isIdle: self.toggleOverlay(True)
else: self.toggleOverlay(False)
if self.service.player.sleepTime > 0 and (self.idleTime > (self.service.player.sleepTime * 10800)):
self.triggerSleep()


def toggleOverlay(self, state: bool=True):
if state and not hasattr(self.overlay, 'open') and self.service.player.enableOverlay:
self.log("toggleOverlay, state = %s"%(state))
self.overlay = Overlay(jsonRPC=self.jsonRPC,player=self.service.player)
self.overlay.open()
elif not state and hasattr(self.overlay, 'close'):
if state and self.service.player.enableOverlay and self.service.player.isPseudoTV:
if self.overlay is None and self.service.player.isPlaying():
self.log("toggleOverlay, state = %s"%(state))
self.overlay = Overlay(jsonRPC=self.jsonRPC,player=self.service.player)
self.overlay.open()
elif not state and not self.overlay is None:
self.log("toggleOverlay, state = %s"%(state))
self.overlay = self.overlay.close()
else: print('toggleOverlay',self.overlay)


def triggerSleep(self):
Expand Down Expand Up @@ -421,6 +427,7 @@ def _suspend(self) -> bool: #continue


def __tasks(self):
if SETTINGS.getSettingBool('Debug_Enable'): self.log('__tasks')
self.tasks._chkEpochTimer('chkQueTimer',self.tasks._chkQueTimer,FIFTEEN)


Expand Down
Binary file not shown.

0 comments on commit 56e2111

Please sign in to comment.