Skip to content

Commit

Permalink
v.0.5.7j
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Jan 6, 2025
1 parent 6f6a5c9 commit 0ddd1be
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 206 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.7i" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.7j" 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 @@
a3abfbe736a27b47783daeab4dcbd30c
b3595896623cfbf05b58126ffae488a2
4 changes: 0 additions & 4 deletions language_report.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Language IDS w\empty strings: {
"32024": "",
"32197": "",
"33085": "",
"33130": ""
}
Expand Down Expand Up @@ -171,7 +169,6 @@ Language IDS not found in py files, possibly only in xml: {
"32011": "Music Genres",
"32012": "Recommended",
"32013": "Services",
"32024": "",
"32033": "Offline",
"32048": "Select Servers",
"32049": "Restarting...",
Expand Down Expand Up @@ -210,7 +207,6 @@ Language IDS not found in py files, possibly only in xml: {
"32170": "- Delete Path",
"32177": "Finish Configuring channel first",
"32182": "ZeroConf Status:",
"32197": "",
"32208": "Parsing Trailer",
"32210": "Parsing Details",
"32218": "Not Needed...",
Expand Down
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.7i" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.7j" 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
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ msgid "Channel"
msgstr ""

msgctxt "#32024"
msgid ""
msgid "Autotuning available via Misc. Utilities"
msgstr ""

msgctxt "#32025"
Expand Down Expand Up @@ -1608,7 +1608,7 @@ msgid "Video"
msgstr ""

msgctxt "#32197"
msgid ""
msgid "Currently Supported!"
msgstr ""

msgctxt "#32198"
Expand Down
36 changes: 19 additions & 17 deletions plugin.video.pseudotv.live/resources/lib/autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from globals import *
from library import Library
from channels import Channels
from backup import Backup

class Autotune:
def __init__(self, sysARG=sys.argv, service=None):
Expand Down Expand Up @@ -50,21 +49,24 @@ def getAutotuned(self) -> dict:


def _runTune(self, samples: bool=False, rebuild: bool=False, dia=None):
autoEnabled = []
customChannels = self.getCustom()
autoChannels = self.getAutotuned()
self.log('_runTune, custom channels = %s, autotune channels = %s'%(len(customChannels),len(autoChannels)))
hasAutotuned = SETTINGS.hasAutotuned()
self.log('_runTune, custom channels = %s, autotune channels = %s, has autotuned = %s'%(len(customChannels),len(autoChannels),hasAutotuned))

if len(autoChannels) > 0: #rebuild existing autotune
if len(autoChannels) > 0: #rebuild existing autotune, no samples needed
rebuild = True
PROPERTIES.setEXTPropertyBool('%s.has.Predefined'%(ADDON_ID),True)
elif len(customChannels) == 0 and not PROPERTIES.hasAutotuned():
autoEnabled = []
elif len(customChannels) == 0 and not hasAutotuned: #begin check if samples needed
[autoEnabled.extend(self.library.getEnabled(type)) for type in AUTOTUNE_TYPES]
if len(autoEnabled) > 0:
self.log('_runTune, library enabled items = %s; recovering enabled items'%(len(autoEnabled)))
rebuild = True #recover empty channels.json with enabled library.json items.
elif isCenterlized(): return True
else: samples = True #create sample channels "autotune".
rebuild = True #recover empty channels.json with enabled library.json items.
elif hasAutotuned: # autotune already ran once, manual only going forward
return DIALOG.notificationDialog(LANGUAGE(32024))
else:
samples = True #create sample channels "autotune".

if samples:
hasBackup = PROPERTIES.hasBackup()
Expand All @@ -82,11 +84,12 @@ def _runTune(self, samples: bool=False, rebuild: bool=False, dia=None):
msg = (LANGUAGE(32042)%ADDON_NAME)

retval = DIALOG.yesnoDialog(message=msg,customlabel=opt)
if retval == 1: dia = DIALOG.progressBGDialog(header='%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(32021),LANGUAGE(30038))))
elif retval == 2:
if hasBackup: return Backup().recoverChannels()
if retval == 1: dia = DIALOG.progressBGDialog(header='%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(32021),LANGUAGE(30038)))) #Yes
elif retval == 2: #Custom
if hasBackup: return BUILTIN.executebuiltin('RunScript(special://home/addons/%s/resources/lib/backup.py, Recover_Channels)'%(ADDON_ID))
elif hasServers: return BUILTIN.executebuiltin('RunScript(special://home/addons/%s/resources/lib/multiroom.py, Select_Server)'%(ADDON_ID))
elif not hasChannels: return openAddonSettings()
elif not hasChannels: return openAddonSettings() #No w/exception
else: return True #No
else: return True

for idx, ATtype in enumerate(AUTOTUNE_TYPES):
Expand Down Expand Up @@ -137,10 +140,9 @@ def buildAUTOTUNE(self, ATtype: str, items: list=[]):
if not list: return
def buildAvailableRange(existing):
# create number array for given type, excluding existing channel numbers.
if existing:
existingNUMBERS = [eitem.get('number') for eitem in existing if eitem.get('number',0) > 0] # existing channel numbers
else:
existingNUMBERS = []
if existing: existingNUMBERS = [eitem.get('number') for eitem in existing if eitem.get('number',0) > 0] # existing channel numbers
else: existingNUMBERS = []

start = ((CHANNEL_LIMIT+1)*(AUTOTUNE_TYPES.index(ATtype)+1))
stop = (start + CHANNEL_LIMIT)
self.log('buildAUTOTUNE, ATtype = %s, range = %s-%s, existingNUMBERS = %s'%(ATtype,start,stop,existingNUMBERS))
Expand Down Expand Up @@ -173,7 +175,7 @@ def buildAvailableRange(existing):
citem['logo'] = eitem.get('logo',citem.get('logo',LOGO))
citem['favorite'] = eitem.get('favorite',False)
self.channels.addChannel(citem)
PROPERTIES.setUpdateChannels(citem['id'])
SETTINGS.setUpdateChannels(citem['id'])
return self.channels.setChannels()


Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def buildList(self, citem: dict, path: str, media: str='video', page: int=SETTIN
fileList = randomShuffle(fileList)

self.kodiTrailers(trailersdict)
self.log("buildList, id: %s returning (%s) files, (%s) dirs."%(citem['id'],len(fileList),len(dirList)))
self.log("buildList, [%s] returning (%s) files, (%s) dirs."%(citem['id'],len(fileList),len(dirList)))
return fileList, dirList


Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/context_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def add(self):
channelData['id'] = getChannelID(channelData['name'], channelData['path'], channelData['number'])
manager.channels.addChannel(channelData)
manager.channels.setChannels()
PROPERTIES.setUpdateChannels(channelData['id'])
SETTINGS.setUpdateChannels(channelData['id'])
manager.closeManager()
del manager
manager = Manager(MANAGER_XML, ADDON_PATH, "default", channel=channelData['number'])
Expand Down
8 changes: 5 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def run(sysARG, fitem: dict={}, nitem: dict={}):
params['name'] = (unquoteString(params.get("name",'')) or BUILTIN.getInfoLabel('ChannelName'))
params['isPlaylist'] = bool(SETTINGS.getSettingInt('Playback_Method'))
log("Default: run, params = %s"%(params))
if PROPERTIES.isRunning('togglePVR'): DIALOG.notificationDialog(LANGUAGE(32000))
elif params.get('start') == '{utc}': DIALOG.okDialog(LANGUAGE(32129)%(PVR_CLIENT_NAME))

if PROPERTIES.isRunning('togglePVR'): DIALOG.notificationDialog(LANGUAGE(32000))
elif mode == 'live':
if params['isPlaylist']: threadit(Plugin(sysARG, sysInfo=params).playPlaylist)(params["name"],params["chid"])
if params.get('start') == '{utc}':DIALOG.okDialog(LANGUAGE(32129)%(PVR_CLIENT_NAME))
elif params['isPlaylist']: threadit(Plugin(sysARG, sysInfo=params).playPlaylist)(params["name"],params["chid"])
elif params['vid'] : threadit(Plugin(sysARG, sysInfo=params).playLive)(params["name"],params["chid"],params["vid"])
else: threadit(Plugin(sysARG, sysInfo=params).playTV)(params["name"],params["chid"])
elif mode in ['vod','dvr']: threadit(Plugin(sysARG, sysInfo=params).playVOD)(params["title"],params["vid"])
Expand All @@ -46,5 +47,6 @@ def run(sysARG, fitem: dict={}, nitem: dict={}):
elif mode == 'guide' and hasAddon(PVR_CLIENT_ID,install=True,enable=True): SETTINGS.openGuide()
elif mode == 'settings' and hasAddon(PVR_CLIENT_ID,install=True,enable=True): openAddonSettings()
else: DIALOG.notificationDialog(LANGUAGE(32000))
MONITOR().waitForAbort(float(SETTINGS.getSettingInt('RPC_Delay')/1000))

if __name__ == '__main__': run(sys.argv,fitem=decodePlot(BUILTIN.getInfoLabel('Plot')),nitem=decodePlot(BUILTIN.getInfoLabel('NextPlot')))
6 changes: 0 additions & 6 deletions plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,6 @@ def openAddonSettings(ctl=(0,1),id=ADDON_ID):
BUILTIN.executebuiltin('SetFocus(%i)'%(ctl[1]-180))
return True

def startChannelBuild():
PROPERTIES.setAutotuned(False)
PROPERTIES.setEpochTimer('chkAutoTune')
BUILTIN.closeBusyDialog()
return BUILTIN.executebuiltin('ActivateWindow(home)')

def diffRuntime(dur, roundto=15):
def ceil_dt(dt, delta):
return dt + (datetime.datetime.min - dt) % delta
Expand Down
125 changes: 64 additions & 61 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,49 @@ def getCacheSetting(self, key, checksum=1, json_data=False, revive=True):
else: return self.cacheDB.get(key, checksum, json_data)


def getEXTMeta(self, id):
addon = xbmcaddon.Addon(id)
properties = ['name', 'version', 'summary', 'description', 'path', 'author', 'icon', 'disclaimer', 'fanart', 'changelog', 'id', 'profile', 'stars', 'type']
for property in properties: yield (property, addon.getAddonInfo(property))


def getEXTSetting(self, id, key):
return xbmcaddon.Addon(id).getSetting(key)


def getFriendlyName(self):
from jsonrpc import JSONRPC
return JSONRPC().inputFriendlyName()


def getMYUUID(self):
friendly = self.getFriendlyName()
uuid = self.getCacheSetting('MY_UUID', checksum=friendly)
if not uuid: uuid = self.setCacheSetting('MY_UUID', genUUID(seed=self.getFriendlyName()), checksum=friendly)
return uuid


def getResetChannels(self):
ids = (self.getCacheSetting('clearChannels') or [])
self.clrCacheSetting('clearChannels')
return ids


def getUpdateChannels(self):
ids = (self.getCacheSetting('updateChannels') or [])
self.clrCacheSetting('updateChannels')
return ids


def hasAutotuned(self):
return self.getCacheSetting('has.Autotuned') == True


#CLR
def clrCacheSetting(self, key, checksum=1, life=datetime.timedelta(days=84), json_data=False):
self.setCacheSetting(key, None, checksum, life, json_data)


#SET
def _setSetting(self, func, key, value):
try:
Expand Down Expand Up @@ -306,30 +349,24 @@ def setCacheSetting(self, key, value, checksum=1, life=datetime.timedelta(days=8
return self.cacheDB.set(key, value, checksum, life, json_data)


def getEXTMeta(self, id):
addon = xbmcaddon.Addon(id)
properties = ['name', 'version', 'summary', 'description', 'path', 'author', 'icon', 'disclaimer', 'fanart', 'changelog', 'id', 'profile', 'stars', 'type']
for property in properties: yield (property, addon.getAddonInfo(property))


def getEXTSetting(self, id, key):
return xbmcaddon.Addon(id).getSetting(key)


def setEXTSetting(self, id, key, value):
return xbmcaddon.Addon(id).setSetting(key,value)


def getFriendlyName(self):
from jsonrpc import JSONRPC
return JSONRPC().inputFriendlyName()
def setUpdateChannels(self, id):
ids = self.getUpdateChannels()
ids.append(id)
return self.setCacheSetting('updateChannels',list(set(ids)))


def setResetChannels(self, id):
ids = self.getResetChannels()
ids.append(id)
return self.setCacheSetting('clearChannels',list(set(ids)))


def getMYUUID(self):
friendly = self.getFriendlyName()
uuid = self.getCacheSetting('MY_UUID', checksum=friendly)
if not uuid: uuid = self.setCacheSetting('MY_UUID', genUUID(seed=self.getFriendlyName()), checksum=friendly)
return uuid
def setAutotuned(self, state=True):
return self.setCacheSetting('has.Autotuned',state)


@cacheit(expiration=datetime.timedelta(minutes=5), json_data=True)
Expand Down Expand Up @@ -609,7 +646,7 @@ def log(self, msg, level=xbmc.LOGDEBUG):
def clrInstanceID(self):
instanceID = self.getEXTProperty('%s.InstanceID'%(ADDON_ID))
if instanceID: self.clearTrash(instanceID)
self.clearEXTProperty('%s.InstanceID'%(ADDON_ID))
self.clrEXTProperty('%s.InstanceID'%(ADDON_ID))


def setInstanceID(self):
Expand Down Expand Up @@ -643,42 +680,12 @@ def getLegacy(self):

def forceUpdateTime(self, key):
return self.setPropertyInt(key,0)


def getUpdateChannels(self):
ids = self.getPropertyList('updateChannels')
self.clearProperty('updateChannels')
return ids


def setUpdateChannels(self, id):
ids = self.getPropertyList('updateChannels')
ids.append(id)
self.setPropertyList('updateChannels',list(set(ids)))
return self.setEpochTimer('chkChannels')


def getClearChannels(self):
ids = self.getPropertyList('clearChannels')
self.clearProperty('clearChannels')
return ids


def setClearChannels(self, id):
ids = self.getPropertyList('clearChannels')
ids.append(id)
self.setPropertyList('clearChannels',list(set(ids)))
return self.setEpochTimer('chkChannels')


def setEpochTimer(self, key, state=True):
return self.setEXTPropertyBool('%s.%s'%(ADDON_ID,key),state)


def setAutotuned(self, state=True):
return self.setEXTPropertyBool('%s.has.Autotuned'%(ADDON_ID),state)


def setChannels(self, state=True):
return self.setEXTPropertyBool('%s.has.Channels'%(ADDON_ID),state)

Expand Down Expand Up @@ -752,10 +759,6 @@ def suspendActivity(self): #suspend/quit running background task.
else: yield


def hasAutotuned(self):
return self.getEXTPropertyBool('%s.has.Autotuned'%(ADDON_ID))


def hasChannels(self):
return self.getEXTPropertyBool('%s.has.Channels'%(ADDON_ID))

Expand Down Expand Up @@ -805,19 +808,19 @@ def getKey(self, key, instanceID=True):


#CLEAR
def clearEXTProperty(self, key):
self.log('clearEXTProperty, id = %s, key = %s'%(10000,key))
def clrEXTProperty(self, key):
self.log('clrEXTProperty, id = %s, key = %s'%(10000,key))
return xbmcgui.Window(10000).clearProperty(key)


def clearProperties(self):
self.log('clearProperties')
def clrProperties(self):
self.log('clrProperties')
return self.window.clearProperties()


def clearProperty(self, key):
def clrProperty(self, key):
key = self.getKey(key)
self.log('clearProperty, id = %s, key = %s'%(self.winID,key))
self.log('clrProperty, id = %s, key = %s'%(self.winID,key))
return self.window.clearProperty(key)


Expand Down Expand Up @@ -912,7 +915,7 @@ def setTrash(self, key): #catalog instance properties that may become abandoned.
def clearTrash(self, instanceID=None): #clear abandoned properties after instanceID change
self.log('clearTrash, instanceID = %s'%(instanceID))
tmpDCT = loadJSON(self.getEXTProperty('%s.TRASH'%(ADDON_ID)))
for prop in tmpDCT.get(instanceID,[]): self.clearEXTProperty(prop)
for prop in tmpDCT.get(instanceID,[]): self.clrEXTProperty(prop)


def __exit__(self):
Expand Down Expand Up @@ -1126,7 +1129,7 @@ def log(self, msg, level=xbmc.LOGDEBUG):
def toggleInfoMonitor(self, state, wait=0.1):
self.log('toggleInfoMonitor, state = %s'%(state))
if self.properties.setPropertyBool('chkInfoMonitor',state):
self.properties.clearProperty('monitor.montiorList')
self.properties.clrProperty('monitor.montiorList')
timerit(self.doInfoMonitor)(0.1)


Expand Down
Loading

0 comments on commit 0ddd1be

Please sign in to comment.