Skip to content

Commit

Permalink
v.0.5.5i
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Oct 25, 2024
1 parent 265b12d commit 70cd981
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 51 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.5h" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5i" 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 @@
df72e7a2a11f0b983b65edc5c8f79ca6
0fdcfb6209430b3b8c1f691b8a0fe5e5
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.5h" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5i" 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
13 changes: 9 additions & 4 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, service=None):
self.xsp = XSP()
self.m3u = M3U()
self.resources = Resources(self.jsonRPC)
self.completeBuild = False


self.bctTypes = {"ratings" :{"min":-1,"max":SETTINGS.getSettingInt('Enable_Preroll') ,"auto":SETTINGS.getSettingInt('Enable_Preroll') == -1,"enabled":bool(SETTINGS.getSettingInt('Enable_Preroll')) ,
Expand Down Expand Up @@ -119,7 +120,7 @@ def build(self):
self.pMSG = '%s: %s'%(LANGUAGE(32144),LANGUAGE(32212))
self.pName = citem['name']
self.pCount = int(idx*100//len(channels))

while not self.service.monitor.abortRequested() and self.service._suspend():
if self.service._interrupt(OVERLAY_DELAY):
self.completeBuild = False
Expand All @@ -131,7 +132,7 @@ def build(self):
if self.service._interrupt():
self.pErrors = [LANGUAGE(32160)]
self.completeBuild = False
if self.pDialog: self.pDialog = DIALOG.progressBGDialog(self.pCount, self.pDialog, message='%s: %s'%(LANGUAGE(32144),LANGUAGE(32213)), header=ADDON_NAME)
self.pDialog = DIALOG.progressBGDialog(self.pCount, self.pDialog, message='%s: %s'%(LANGUAGE(32144),LANGUAGE(32213)), header=ADDON_NAME)
break
else:
self.runActions(RULES_ACTION_CHANNEL_START, citem, inherited=self)
Expand Down Expand Up @@ -242,8 +243,12 @@ def _validFileList(fileArray):
fileArray = self.runActions(RULES_ACTION_CHANNEL_BUILD_FILEARRAY_PRE, citem, list(), inherited=self)
if not _validFileList(fileArray):
for idx, file in enumerate(citem.get('path',[])):
if len(citem.get('path',[])) > 1: self.pName = '%s %s/%s'%(citem['name'],idx+1,len(citem.get('path',[])))
fileArray.append(self.buildFileList(citem, self.runActions(RULES_ACTION_CHANNEL_BUILD_PATH, citem, file, inherited=self), 'video', self.limit, self.sort, self.limits))
if self.service._interrupt():
self.completeBuild = False
break
else:
if len(citem.get('path',[])) > 1: self.pName = '%s %s/%s'%(citem['name'],idx+1,len(citem.get('path',[])))
fileArray.append(self.buildFileList(citem, self.runActions(RULES_ACTION_CHANNEL_BUILD_PATH, citem, file, inherited=self), 'video', self.limit, self.sort, self.limits))

fileArray = self.runActions(RULES_ACTION_CHANNEL_BUILD_FILEARRAY_POST, citem, fileArray, inherited=self)
if not _validFileList(fileArray):#check that at least one fileList in array contains meta
Expand Down
16 changes: 11 additions & 5 deletions plugin.video.pseudotv.live/resources/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@
'mediatype' : (str,), #string - "music", "song", "album", "artist"
'dbid' : (int,), #integer (23) - Only add this for items which are part of the local db. You also need to set the correct 'mediatype'!
'listeners' : (int,), #integer (25614)
'musicbrainztrackid' : (tuple,list),
'musicbrainzartistid' : (tuple,list),
'musicbrainzalbumid' : (tuple,list),
'musicbrainzalbumartistid': (tuple,list),
'musicbrainztrackid' : (str,tuple,list),
'musicbrainzartistid' : (str,tuple,list),
'musicbrainzalbumid' : (str,tuple,list),
'musicbrainzalbumartistid': (str,tuple,list),
'comment' : (str,),
'count' : (int,), #integer (12) - can be used to store an id for later, or for sorting purposes
# 'size' : (int,), #long (1024) - size in bytes
Expand Down Expand Up @@ -331,4 +331,10 @@

IGNORE_CHTYPE = ['TV Shows','Mixed','Recommended','Services',"Music Genres"]
MOVIE_CHTYPE = ["Movie Genres","Movie Studios"]
TV_CHTYPE = ["TV Networks","TV Genres","Mixed Genre"]
TV_CHTYPE = ["TV Networks","TV Genres","Mixed Genre"]

PRIMARY_BACKGROUND = 'FF11375C'
SECONDARY_BACKGROUND = '334F4F9E'
DIALOG_TINT = 'FF181B1E'
BUTTON_FOCUS = 'FF2866A4'
SELECTED = 'FF5BE5EE'
5 changes: 3 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/context_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def add(self):
msg = LANGUAGE(30119)
retval = DIALOG.yesnoDialog('Would you like to add:\n[B]%s[/B]\nto %s recordings?'%(self.fitem['label'],msg),customlabel=opt)
if retval or int(retval) > 0:
with BUILTIN.busy_dialog(), PROPERTIES.interruptActivity():
with PROPERTIES.interruptActivity(), BUILTIN.busy_dialog():
m3u = M3U()
ritem = m3u.getRecordItem(self.fitem,{'1':0,'2':seek}[str(int(retval))])
if (m3u.addRecording(ritem), XMLTVS().addRecording(ritem,self.fitem)):
Expand All @@ -60,8 +60,9 @@ def remove(self):
if not PROPERTIES.isRunning('Record.remove'):
with PROPERTIES.setRunning('Record.remove'):
if DIALOG.yesnoDialog('Would you like to remove:\n[B]%s[/B]\nfrom recordings?'%(self.fitem['label'])):
with BUILTIN.busy_dialog(), PROPERTIES.interruptActivity():
with PROPERTIES.interruptActivity(), BUILTIN.busy_dialog():
ritem = (self.fitem.get('citem') or {"name":self.fitem['label'],"path":self.listitem.getPath()})
log('Record: remove, ritem = %s'%(ritem))
if (M3U().delRecording(ritem), XMLTVS().delRecording(ritem)):
DIALOG.notificationWait('%s\n%s'%(ritem['name'],LANGUAGE(30118)))
PROPERTIES.setEpochTimer('chkPVRRefresh')
Expand Down
14 changes: 8 additions & 6 deletions plugin.video.pseudotv.live/resources/lib/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def _suspend(self) -> bool:
class Library:
def __init__(self, service=None):
if service is None: service = Service()
self.completeFill = False
self.service = service
self.parserCount = 0
self.parserMSG = ''
Expand Down Expand Up @@ -104,6 +105,7 @@ def fillItems(self):
self.parserDialog = DIALOG.progressBGDialog(self.parserCount,header='%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(30014),LANGUAGE(32041))))
for idx, type in enumerate(AUTOTUNE_TYPES):
if self.service._interrupt():
self.completeFill = False
self.parserDialog = DIALOG.progressBGDialog(100,self.parserDialog)
break
else:
Expand Down Expand Up @@ -136,20 +138,20 @@ def __update(type, item):
if force: #clear library cache.
with BUILTIN.busy_dialog(isPlaying=BUILTIN.getInfoBool('Playing','Player')):
__clear()
libraryItems = dict(self.fillItems())
complete = True
self.completeFill = True
libraryItems = dict(self.fillItems())
self.parserDialog = DIALOG.progressBGDialog(header='%s, %s'%(ADDON_NAME,'%s %s'%(msg,LANGUAGE(32041))))
for idx, type in enumerate(AUTOTUNE_TYPES):
self.parserDialog = DIALOG.progressBGDialog(int(idx*100//len(AUTOTUNE_TYPES)),self.parserDialog,AUTOTUNE_TYPES[idx],'%s, %s'%(ADDON_NAME,'%s %s'%(msg,LANGUAGE(32041))))
if self.service._interrupt():
complete = False
self.completeFill = False
break
else: self.setLibrary(type, [__update(type,item) for item in libraryItems.get(type,[])])

self.parserDialog = DIALOG.progressBGDialog(100,self.parserDialog,LANGUAGE(32025))
self.log('updateLibrary, force = %s, complete = %s'%(force, complete))
return complete
self.log('updateLibrary, force = %s, complete = %s'%(force, self.completeFill))
return self.completeFill


def resetLibrary(self, ATtypes=AUTOTUNE_TYPES):
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def onAction(self, act):
liz.setProperty('sysInfo',encodeString(dumpJSON(self.player.sysInfo)))
self.player.play(self.player.sysInfo.get('fitem',{}).get('catchup-id'),liz)
else: DIALOG.notificationDialog(LANGUAGE(30154))
elif actionId == ACTION_MOVE_UP: BUILTIN.executebuiltin('AlarmClock(up,Action(up),time,100,true,false)')
elif actionId == ACTION_MOVE_DOWN: BUILTIN.executebuiltin('AlarmClock(down,Action(down),time,100,true,false)')
elif actionId in ACTION_PREVIOUS_MENU: BUILTIN.executebuiltin('AlarmClock(back,Action(back),time,100,true,false)')
elif actionId == ACTION_MOVE_UP: BUILTIN.executebuiltin('AlarmClock(up,Action(up),.1,true,false)')
elif actionId == ACTION_MOVE_DOWN: BUILTIN.executebuiltin('AlarmClock(down,Action(down),.1true,false)')
elif actionId in ACTION_PREVIOUS_MENU: BUILTIN.executebuiltin('AlarmClock(back,Action(back),.1,true,false)')
self.onClose()


Expand Down
10 changes: 3 additions & 7 deletions plugin.video.pseudotv.live/resources/lib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def playBroadcast(self, name: str, chid: str, vid: str): #-> catchup-source
def playVOD(self, title: str, vid: str): #-> catchup-id
self.log('playVOD, title = %s, vid = %s'%(title,vid))
with self.preparingPlayback():
if self.sysInfo.get('fitem'): #-> live playback from UI incl. listitem
if self.sysInfo.get('fitem') and self.sysInfo.get('mode','').lower() != 'dvr': #-> live playback from UI incl. listitem
liz = LISTITEMS.buildItemListItem(self.sysInfo.get('fitem'))
self.sysInfo["seek"] = -1
self.sysInfo["progresspercentage"] = -1
Expand Down Expand Up @@ -300,7 +300,7 @@ def buildfItem(item: dict={}):

if len(fileList) > 0:
PLAYER().play(self.quePlaylist(poolit(buildfItem)(randomShuffle(fileList)),pltype=xbmc.PLAYLIST_MUSIC,shuffle=True),windowed=True)
BUILTIN.executebuiltin('ReplaceWindow(visualisation)')
timerit(BUILTIN.executebuiltin)(0.1,['ReplaceWindow(visualisation)'])
self.resolveURL(False, xbmcgui.ListItem())


Expand Down Expand Up @@ -369,8 +369,4 @@ def playError(self):


def resolveURL(self, found, listitem):
xbmcplugin.setResolvedUrl(int(self.sysARG[1]), found, listitem)


# if found and listitem.getPath().endswith('.strm'):
# BUILTIN.executebuiltin('AlarmClock(play,PlayMedia(%s),time,100,true,false)'%(listitem.getPath()))
xbmcplugin.setResolvedUrl(int(self.sysARG[1]), found, listitem)
19 changes: 12 additions & 7 deletions plugin.video.pseudotv.live/resources/lib/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ class Player(xbmc.Player):
def __init__(self, service=None):
self.log('__init__')
xbmc.Player.__init__(self)
self.service = service
self.jsonRPC = service.jsonRPC
self.lastSubState = BUILTIN.isSubtitle()
self.disableTrakt = SETTINGS.getSettingBool('Disable_Trakt')
self.rollbackPlaycount = SETTINGS.getSettingBool('Rollback_Watched')
self.restartPercentage = SETTINGS.getSettingInt('Restart_Percentage')
self.saveDuration = SETTINGS.getSettingBool('Store_Duration')
self.service = service
self.jsonRPC = service.jsonRPC
self.updateGlobals()

"""
Player() Trigger Order
Expand All @@ -63,6 +59,14 @@ def log(self, msg, level=xbmc.LOGDEBUG):
return log('%s: %s'%(self.__class__.__name__,msg),level)


def updateGlobals(self):
self.lastSubState = BUILTIN.isSubtitle()
self.disableTrakt = SETTINGS.getSettingBool('Disable_Trakt')
self.rollbackPlaycount = SETTINGS.getSettingBool('Rollback_Watched')
self.restartPercentage = SETTINGS.getSettingInt('Restart_Percentage')
self.saveDuration = SETTINGS.getSettingBool('Store_Duration')


def onPlayBackStarted(self):
self.log('onPlayBackStarted')
self.onAVChange()
Expand Down Expand Up @@ -182,6 +186,7 @@ def setRuntime(self, state: bool=SETTINGS.getSettingBool('Store_Duration'), fite

def _onPlay(self):
self.log('_onPlay')
self.updateGlobals()
self.toggleReplay(False)
self.toggleBackground(False)

Expand Down
40 changes: 40 additions & 0 deletions plugin.video.pseudotv.live/resources/lib/skin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (C) 2024 Lunatixz
#
#
# This file is part of PseudoTV Live.
#
# PseudoTV Live is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PseudoTV Live is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PseudoTV Live. If not, see <http://www.gnu.org/licenses/>.
#
# -*- coding: utf-8 -*-
from globals import *

class Service:
from jsonrpc import JSONRPC
monitor = MONITOR()
jsonRPC = JSONRPC()
def _interrupt(self, wait: float=.001) -> bool:
return self.monitor.waitForAbort(wait)
def _suspend(self) -> bool:
return PROPERTIES.isPendingSuspend()

class Skin:
def __init__(self, service=None):
if service is None: service = Service()
self.jsonRPC = service.jsonRPC



lookandfeel.skincolors
{"jsonrpc":"2.0","method":"Settings.GetSettingValue","params":{"setting":"lookandfeel.skincolors"}.get('value')
{"jsonrpc":"2.0","method":"Files.GetDirectory","params":{"directory":"special://skin/colors/"}..get('files')
25 changes: 12 additions & 13 deletions plugin.video.pseudotv.live/resources/lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _initialize(self):

for func in tasks:
if self.service._interrupt(): break
self._que(func)
else: self._que(func)
self.log('_initialize, finished...')


Expand Down Expand Up @@ -124,18 +124,16 @@ def _chkQueTimer(self):
def _chkEpochTimer(self, key, func, runevery, nextrun=None, *args, **kwargs):
if nextrun is None: nextrun = (PROPERTIES.getPropertyInt(key) or 0)# nextrun == 0 => force que
epoch = int(time.time())
que = (epoch >= nextrun)
if que and (not self.service._interrupt() and not self.service._suspend()):
self.log('_chkEpochTimer, key = %s, que = %s'%(key,que))
if epoch >= nextrun:
self.log('_chkEpochTimer, key = %s'%(key))
PROPERTIES.setPropertyInt(key,(epoch+runevery))
return self._que(func)


def _chkPropTimer(self, key, func):
key = '%s.%s'%(ADDON_ID,key)
run = PROPERTIES.getEXTProperty(key) == 'true'
self.log('_chkPropTimer, key = %s, run = %s'%(key,run))
if run and (not self.service._interrupt() and not self.service._suspend()):
if PROPERTIES.getEXTProperty(key) == 'true':
self.log('_chkPropTimer, key = %s'%(key))
PROPERTIES.clearEXTProperty(key)
self._que(func)

Expand Down Expand Up @@ -259,12 +257,13 @@ def chkFillers(self, channels=None):
if self.service._interrupt(): break
for ftype in FILLER_TYPES[1:]:
if self.service._interrupt(): break
[FileAccess.makedirs(os.path.join(FILLER_LOC,ftype.lower(),genre.lower())) for genre in self.getGenreNames() if not FileAccess.exists(os.path.join(FILLER_LOC,ftype.lower(),genre.lower(),''))]
if not FileAccess.exists(os.path.join(FILLER_LOC,ftype.lower(),citem.get('name','').lower())):
if ftype.lower() == 'adverts': IGNORE = IGNORE_CHTYPE + MOVIE_CHTYPE
else: IGNORE = IGNORE_CHTYPE
if citem.get('name') and not citem.get('radio',False) and citem.get('type') not in IGNORE:
FileAccess.makedirs(os.path.join(FILLER_LOC,ftype.lower(),citem['name'].lower()))
else:
[FileAccess.makedirs(os.path.join(FILLER_LOC,ftype.lower(),genre.lower())) for genre in self.getGenreNames() if not FileAccess.exists(os.path.join(FILLER_LOC,ftype.lower(),genre.lower(),''))]
if not FileAccess.exists(os.path.join(FILLER_LOC,ftype.lower(),citem.get('name','').lower())):
if ftype.lower() == 'adverts': IGNORE = IGNORE_CHTYPE + MOVIE_CHTYPE
else: IGNORE = IGNORE_CHTYPE
if citem.get('name') and not citem.get('radio',False) and citem.get('type') not in IGNORE:
FileAccess.makedirs(os.path.join(FILLER_LOC,ftype.lower(),citem['name'].lower()))


def runAutoTune(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<onunfocus/>
<visible>Player.Playing + Window.IsActive(fullscreenvideo)</visible>
<visible>!String.Contains(VideoPlayer.Genre,Pre-Roll) | !String.Contains(VideoPlayer.Genre,Post-Roll)</visible>
<visible>!Window.IsActive(seekbar) | !Window.IsActive(pvrosdchannels) | !Window.IsActive(pvrchannelguide)</visible>
</control>
</control>
</controls>
Expand Down
Binary file not shown.

0 comments on commit 70cd981

Please sign in to comment.