Skip to content

Commit

Permalink
v.0.5.5s
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Nov 12, 2024
1 parent 5e10dc5 commit da8806a
Show file tree
Hide file tree
Showing 30 changed files with 317 additions and 235 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.5r" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5s" 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 @@
53ae6ff3a0b2faa8007e14c40ce32e24
5db42a3e63b6fd3103558ba3dc789fc6
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.5r" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5s" 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
3 changes: 3 additions & 0 deletions plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
v.0.5.6
-Improved MediaInfo support for external mediainfo.xml file parsing.
-Fixed Issue with disappearing channels from m3u.
-Tweaked Background overlay.
-Added Multi-Room channels to the channel manager w/ default server option in settings.
- W.I.P there will be bugs (remote save disabled until finished.); For proper system setup info can be found on the wiki under "Recommend Prerequisites".
- All Kodi instances are required to broadcast Zeroconf for two way communication between PseudoTV Live instances.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ msgid "Select server to remove."
msgstr ""

msgctxt "#32184"
msgid "Replay Percentage (%s)"
msgid "Restart Percentage (%s)"
msgstr ""

msgctxt "#32185"
Expand Down
3 changes: 2 additions & 1 deletion plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def getFileList(self, citem: dict, now: time, start: time) -> bool and list:
if cacheResponse:
if self.fillBCTs and not radio: cacheResponse = Fillers(builder=self).injectBCTs(citem, cacheResponse)
return sorted(self.addScheduling(citem, cacheResponse, start), key=itemgetter('start'))
return cacheResponse
elif self.service._interrupt(): return True
else: return cacheResponse
except Exception as e: self.log("getFileList, [%s] failed! %s"%(citem['id'],e), xbmc.LOGERROR)
return False

Expand Down
4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
PLAYER = xbmc.Player

#constants
FIFTEEN = 15 #unit
DISCOVERY_TIMER = 60 #secs
EPOCH_TIMER = 15 #secs
SUSPEND_TIMER = 15 #secs
SUSPEND_TIMER = 5 #secs
DISCOVER_INTERVAL = 30 #secs
EPG_DURATION = 10800 #secs
DTFORMAT = '%Y%m%d%H%M%S'
Expand Down
4 changes: 2 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 PROPERTIES.interruptActivity(), BUILTIN.busy_dialog():
with BUILTIN.busy_dialog(), PROPERTIES.interruptActivity():
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,7 +60,7 @@ 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 PROPERTIES.interruptActivity(), BUILTIN.busy_dialog():
with BUILTIN.busy_dialog(), PROPERTIES.interruptActivity():
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)):
Expand Down
9 changes: 7 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/cqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def __pop(self):
self.log("__pop, The priority queue is empty!")
break
else:
min_num, _, package = heapq.heappop(self.min_heap)
try: min_num, _, package = heapq.heappop(self.min_heap)
except Exception as e:
self.log("__pop, heappop failed! %s\nmin_heap = %s"%(e,self.min_heap), xbmc.LOGERROR)
continue
self.qsize -= 1
self.__run(*package)

Expand All @@ -146,7 +149,9 @@ def __pop(self):
if not self.delay: package, self.__run(*package)
else:
popTimer = Timer(curr_node.wait, *package)
if popTimer.is_alive(): popTimer.join()
if popTimer.is_alive():
try: popTimer.join()
except: pass
else:
popTimer.daemon = True
popTimer.start()
Expand Down
6 changes: 6 additions & 0 deletions plugin.video.pseudotv.live/resources/lib/fileaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def open(filename, mode, encoding=DEFAULT_ENCODING):
return fle


@contextmanager
def sopen(filename, mode, encoding=DEFAULT_ENCODING):
with xbmcvfs.File(filename, mode) as fle:
yield fle


@staticmethod
def listdir(path):
return xbmcvfs.listdir(path)
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def KODI_LIVETV_SETTINGS(): #recommended Kodi LiveTV settings
# 'epg.epgupdate':120,
'pvrmanager.startgroupchannelnumbersfromone':'false'}

def togglePVR(state=True, reverse=False, wait=EPOCH_TIMER):
def togglePVR(state=True, reverse=False, wait=FIFTEEN):
if not PROPERTIES.isRunning('togglePVR') and SETTINGS.getSettingBool('Enable_PVR_RELOAD'):
with PROPERTIES.setRunning('togglePVR'):
log('globals: togglePVR, state = %s, reverse = %s, wait = %s'%(state,reverse,wait))
Expand Down
12 changes: 6 additions & 6 deletions plugin.video.pseudotv.live/resources/lib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def getSetting(self, category, section, cache=True):
else: return self.sendJSON(param).get('result', {}).get('settings',[])


def getSettingValue(self, key, cache=True):
def getSettingValue(self, key, default='', cache=True):
param = {"method":"Settings.GetSettingValue","params":{"setting":key}}
if cache: return self.cacheJSON(param).get('result',{}).get('value','')
else: return self.sendJSON(param).get('result',{}).get('value','')
if cache: return (self.cacheJSON(param).get('result',{}).get('value')or default)
else: return (self.sendJSON(param).get('result',{}).get('value') or default)


def setSettingValue(self, key, value):
Expand Down Expand Up @@ -522,9 +522,9 @@ def padItems(self, files, page=SETTINGS.getSettingInt('Page_Limit')):
return files


@cacheit(expiration=datetime.timedelta(seconds=EPOCH_TIMER),json_data=False)
@cacheit(expiration=datetime.timedelta(seconds=FIFTEEN),json_data=False)
def inputFriendlyName(self):
with PROPERTIES.suspendActivity():
with PROPERTIES.interruptActivity():
friendly = self.getSettingValue("services.devicename")
self.log("inputFriendlyName, name = %s"%(friendly))
if not friendly or friendly.lower() == 'kodi':
Expand All @@ -546,7 +546,7 @@ def _matchJSON():#requires 'pvr://' json whitelisting.
for result in results:
if result.get('label','').lower().startswith(dir.lower()):
self.log('getCallback: _matchJSON, found dir = %s'%(result.get('file')))
channels = self.getDirectory(param={"directory":result.get('file')},checksum=PROPERTIES.getInstanceID(),expiration=datetime.timedelta(minutes=EPOCH_TIMER)).get('files',[])
channels = self.getDirectory(param={"directory":result.get('file')},checksum=PROPERTIES.getInstanceID(),expiration=datetime.timedelta(minutes=FIFTEEN)).get('files',[])
for item in channels:
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')))
Expand Down
34 changes: 19 additions & 15 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ def getIP(wait=5):
del monitor

def convertString2Num(value):
try: return literal_eval(value)
except: return None
try: return literal_eval(value)
except Exception as e:
log("convertString2Num, failed! value = %s %s"%(value,e), xbmc.LOGERROR)
return None

def encodeString(text):
base64_bytes = base64.b64encode(zlib.compress(text.encode(DEFAULT_ENCODING)))
Expand Down Expand Up @@ -187,7 +189,7 @@ def getSettingBoolList(self, key):


def getSettingInt(self, key):
return convertString2Num(self.getSetting(key))
return int(convertString2Num(self.getSetting(key)))


def getSettingIntList(self, key):
Expand All @@ -211,7 +213,7 @@ def getSettingList(self, key):


def getSettingFloat(self, key):
return convertString2Num(self.getSetting(key))
return float(convertString2Num(self.getSetting(key)))


def getSettingFloatList(self, key):
Expand Down Expand Up @@ -809,12 +811,16 @@ def getPropertyDict(self, key=''):
return loadJSON(decodeString(self.getProperty(key)))


def getPropertyInt(self, key):
return convertString2Num(self.getProperty(key))
def getPropertyInt(self, key, default=-1):
value = self.getProperty(key)
if value: return int(convertString2Num(value))
else: return default


def getPropertyFloat(self, key):
return float(convertString2Num(self.getProperty(key)))
def getPropertyFloat(self, key, default=-1):
value = self.getProperty(key)
if value: return float(convertString2Num(value))
else: return default


#SET
Expand Down Expand Up @@ -1032,14 +1038,14 @@ def busy_dialog(self, isPlaying=False):
else: yield


def getInfoLabel(self, key, param='ListItem', timeout=EPOCH_TIMER):
def getInfoLabel(self, key, param='ListItem', timeout=FIFTEEN):
monitor = MONITOR()
value = xbmc.getInfoLabel('%s.%s'%(param,key))
while not monitor.abortRequested() and (value is None or value == 'Busy'):
if monitor.waitForAbort(.0001) or timeout < 0: break
timeout -= .0001
value = xbmc.getInfoLabel('%s.%s'%(param,key))
self.log('getInfoLabel, key = %s.%s, value = %s, time = %s'%(param,key,value,(EPOCH_TIMER-timeout)))
self.log('getInfoLabel, key = %s.%s, value = %s, time = %s'%(param,key,value,(FIFTEEN-timeout)))
del monitor
return value

Expand Down Expand Up @@ -1172,11 +1178,9 @@ def onClick(self, controlId):


def onClose(self):
try:
if self.acThread.is_alive():
self.acThread.cancel()
self.acThread.join()
except: pass
if self.acThread.is_alive():
self.acThread.cancel()
self.acThread.join()
self.close()

if not self.properties.isRunning('qrDialog'):
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,8 @@ def onAction(self, act):
# during certain times we just want to discard all input
if lastaction < .5 and actionId not in ACTION_PREVIOUS_MENU: action = ACTION_INVALID
else:
self.log('onAction: actionId = %s'%(actionId))
if actionId in ACTION_PREVIOUS_MENU:
self.log('onAction: actionId = %s'%(actionId))
if xbmcgui.getCurrentWindowDialogId() == "13001": BUILTIN.executebuiltin("Action(Back)")
elif self.isVisible(self.ruleList): self.toggleruleList(False)
elif self.isVisible(self.itemList): self.togglechanList(True,focus=self.getFocusItems().get('position'))
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/multiroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def getEnabled(self, servers={}):
return enabled


@cacheit(expiration=datetime.timedelta(minutes=EPOCH_TIMER), json_data=True)
@cacheit(expiration=datetime.timedelta(minutes=FIFTEEN), json_data=True)
def getURL(self, remote):
return getURL(remote,header={'Accept':'application/json'},json_data=True)

Expand Down
Loading

0 comments on commit da8806a

Please sign in to comment.