Skip to content

Commit

Permalink
v.0.5.4q
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Oct 10, 2024
1 parent 3bef232 commit 33699c4
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 15 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.4p" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.4q" 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 @@
836fbdc58ebbb216068953a36651d863
0102287ad35eaf1efcf21fed8946aded
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.4p" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.4q" 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
9 changes: 5 additions & 4 deletions plugin.video.pseudotv.live/resources/lib/cqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#
# -*- coding: utf-8 -*-
from globals import *
from pool import ThreadPool
from collections import defaultdict

class LlNode:
Expand Down Expand Up @@ -46,6 +47,7 @@ def __init__(self, fifo: bool=False, lifo: bool=False, priority: bool=False, del
self.min_heap = []
self.itemCount = defaultdict(int)
self.popThread = Thread(target=self.__pop)
self.pool = ThreadPool()


def log(self, msg, level=xbmc.LOGDEBUG):
Expand All @@ -60,11 +62,10 @@ def __start(self):
self.popThread.start()


def __run(self, func, args=(), kwargs=None):
def __run(self, func, args=None, kwargs=None):
self.log("__run, func = %s"%(func.__name__))
try: return executeit(func)(*args, **kwargs)
#return func(*args, **kwargs)
except Exception as e: self.log("__run, func = %s failed! %s"%(func.__name__,e), xbmc.LOGERROR)
try: return self.pool.executor(func, (EPOCH_TIMER*60), *args, *kwargs) # if self.service.player.isPlaying(): return func(*args, **kwargs)
except Exception as e: self.log("__run, func = %s failed! %s\nargs = %s, kwargs = %s"%(func.__name__,e,args,kwargs), xbmc.LOGERROR)


def __exists(self, package):
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def queueJSON(self, param):
queuePool['params'] = sorted(setDictLST(params), key=lambda d: d.get('params',{}).get('playcount',-1))
queuePool['params'] = sorted(setDictLST(params), key=lambda d: d.get('params',{}).get('setting',''))
queuePool['params'].reverse() #prioritize setsetting,playcount rollback over duration amendments.
self.log("queueJSON, queueing = %s\n%s"%(len(queuePool['params']),param))
self.log("queueJSON, saving = %s\n%s"%(len(queuePool['params']),param))
SETTINGS.setCacheSetting('queuePool', queuePool, json_data=True)


Expand Down
14 changes: 9 additions & 5 deletions plugin.video.pseudotv.live/resources/lib/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,22 @@ def log(self, msg, level=xbmc.LOGDEBUG):
return log('%s: %s'%(self.__class__.__name__,msg),level)


@timeit
def executor(self, func, timeout=None, *args, **kwargs):
self.log("executor, func = %s"%(func.__name__))
self.log("executor, func = %s, timeout = %s"%(func.__name__,timeout))
with ThreadPoolExecutor(self.ThreadCount) as executor:
return executor.submit(func, *args, **kwargs).result(timeout)
try: return executor.submit(func, *args, **kwargs).result(timeout)
except Exception as e: self.log("executor, func = %s failed! %s\nargs = %s, kwargs = %s"%(func.__name__,e,args,kwargs), xbmc.LOGERROR)


def executors(self, func, items=[], timeout=None, *args, **kwargs):
self.log("executors, items = %s"%(len(items)))
self.log("executors, func = %s, items = %s, timeout = %s"%(func.__name__,len(items),timeout))
with ThreadPoolExecutor(self.ThreadCount) as executor:
return [self.executor((wrapped_partial(func, *args, **kwargs)), timeout, item) for item in items]
try: return [self.executor((wrapped_partial(func, *args, **kwargs)), timeout, item) for item in items]
except Exception as e: self.log("executors, func = %s, items = %s failed! %s\nargs = %s, kwargs = %s"%(func.__name__,len(items),e,args,kwargs), xbmc.LOGERROR)


def generator(self, func, items=[], *args, **kwargs):
self.log("generator, items = %s"%(len(items)))
return [wrapped_partial(func, *args, **kwargs)(i) for i in items]
try: return [wrapped_partial(func, *args, **kwargs)(i) for i in items]
except Exception as e: self.log("generator, func = %s, items = %s failed! %s\nargs = %s, kwargs = %s"%(func.__name__,len(items),e,args,kwargs), xbmc.LOGERROR)
7 changes: 5 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def log(self, msg, level=xbmc.LOGDEBUG):
def _que(self, func, priority=-1, *args, **kwargs):# priority -1 autostack, 1 Highest, 5 Lowest
if priority == -1: priority = self.quePriority.qsize + 1
self.log('_que, priority = %s, func = %s, args = %s, kwargs = %s' % (priority,func.__name__, args, kwargs))
self.quePriority._push((func,args,kwargs),priority)
self.quePriority._push((func, args, kwargs), priority)


def _initialize(self):
Expand Down Expand Up @@ -252,7 +252,10 @@ def chkJSONQUE(self):
params = queuePool.get('params',[])
for i in list(range(int((REAL_SETTINGS.getSetting('Page_Limit') or "25")))):
if self.service._interrupt(): break
elif len(params) > 0: self._que(self.jsonRPC.sendJSON,10,params.pop(0))
elif len(params) > 0:
param = params.pop(0)
self.log("chkJSONQUE, queueing = %s\n%s"%(len(params),param))
self._que(self.jsonRPC.sendJSON,10, param)
queuePool['params'] = setDictLST(params)
self.log('chkJSONQUE, remaining = %s'%(len(queuePool['params'])))
SETTINGS.setCacheSetting('queuePool', queuePool, json_data=True)
Expand Down
Binary file not shown.

0 comments on commit 33699c4

Please sign in to comment.