Skip to content

Commit

Permalink
v.0.5.6l
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Dec 5, 2024
1 parent d12dee6 commit dcfeb1e
Show file tree
Hide file tree
Showing 30 changed files with 86 additions and 116 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.6k" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.6l" 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 @@
4b68ca73d0bf5072c682fd3146d3a8f5
f5ea19f688753e7e3802d38f8c0a1660
12 changes: 1 addition & 11 deletions language_report.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
Language IDS w\empty strings: {
"30033": "",
"30034": "",
"30035": "",
"30047": "",
"30070": "",
"30073": "",
Expand All @@ -28,10 +25,6 @@ Language IDS w\duplicate strings: {
"30087",
"32068"
],
"Auto": [
"30022",
"32069"
],
"Enter Channel Name": [
"32079",
"32085"
Expand Down Expand Up @@ -93,9 +86,6 @@ Language IDS not found in py files, possibly only in xml: {
"30016": "Fillers",
"30027": "Logo Resource",
"30032": "Resources",
"30033": "",
"30034": "",
"30035": "",
"30036": "Minimum Guide Days",
"30037": "Maximum Guide Days",
"30039": "Clear Recommended Blacklist",
Expand Down Expand Up @@ -299,7 +289,7 @@ Language IDS not found in py files, possibly only in xml: {
"33178": "Select Vignette Image",
"33182": "Enabled in discovered servers in the list below.",
"33186": "Vignette Non-Linear Stretch",
"33202": "Minimum Debugging Level [LOGERROR - Default]",
"33202": "Minimum Debugging Level [LOGERROR - Default]\\nIf submit is [COLOR=dimgray][B]dim[/B][/COLOR] no debugging information logged, change to [B]LOGDEBUG[/B] and reproduce error.",
"33214": "Default Sort Method for all channels, overridden per channel by SmartPlaylist, DynamicPlaylist and Adv. Channel rules.",
"33308": "Install Log Uploader.",
"33309": "Submit debugging log for review to http://paste.kodi.tv."
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.6k" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.6l" 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 @@ -150,15 +150,15 @@ msgid "Resources"
msgstr ""

msgctxt "#30033"
msgid ""
msgid "%s Support & Discussion Thread"
msgstr ""

msgctxt "#30034"
msgid ""
msgid "ZeroConf Already"
msgstr ""

msgctxt "#30035"
msgid ""
msgid "ZeroConf"
msgstr ""

msgctxt "#30036"
Expand Down Expand Up @@ -1072,7 +1072,7 @@ msgid "Browse"
msgstr ""

msgctxt "#32069"
msgid "Auto"
msgid "Ask"
msgstr ""

msgctxt "#32070"
Expand Down Expand Up @@ -2099,7 +2099,7 @@ msgid "Vignette Non-Linear Stretch"
msgstr ""

msgctxt "#33202"
msgid "Minimum Debugging Level [LOGERROR - Default]"
msgid "Minimum Debugging Level [LOGERROR - Default]\nIf submit is [COLOR=dimgray][B]dim[/B][/COLOR] no debugging information logged, change to [B]LOGDEBUG[/B] and reproduce error."
msgstr ""

msgctxt "#33230"
Expand Down
4 changes: 1 addition & 3 deletions plugin.video.pseudotv.live/resources/lib/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ def recoverChannels(self, file: str=CHANNELFLE_BACKUP) -> bool:
with BUILTIN.busy_dialog(), PROPERTIES.interruptActivity():
if FileAccess.move(CHANNELFLEPATH,CHANNELFLE_RESTORE):
if FileAccess.copy(file,CHANNELFLEPATH):
library = Library()
library.resetLibrary()
del library
Library().resetLibrary()
return PROPERTIES.setPendingRestart()


Expand Down
8 changes: 4 additions & 4 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def build(self, channels=None):
self.pDialog = DIALOG.progressBGDialog()
self.completeBuild = True

updated = False
updated = set()
for idx, citem in enumerate(channels):
citem = self.runActions(RULES_ACTION_CHANNEL_TEMP_CITEM, citem, citem, inherited=self)
self.log('build, id = %s, rules = %s'%(citem['id'],citem.get('rules',{})))
Expand All @@ -143,7 +143,7 @@ def build(self, channels=None):
cacheResponse = self.getFileList(citem, now, (stopTimes.get(citem['id']) or start))# {False:'In-Valid Channel', True:'Valid Channel w/o programmes', list:'Valid Channel w/ programmes}
if cacheResponse:
if self.addChannelStation(citem) and (isinstance(cacheResponse,list) and len(cacheResponse) > 0):
updated = self.addChannelProgrammes(citem, cacheResponse) #added xmltv lineup entries.
updated.add(self.addChannelProgrammes(citem, cacheResponse)) #added xmltv lineup entries.
else:
if self.completeBuild: self.pErrors.append(LANGUAGE(32026))
chanErrors = ' | '.join(list(sorted(set(self.pErrors))))
Expand All @@ -153,8 +153,8 @@ def build(self, channels=None):
self.runActions(RULES_ACTION_CHANNEL_STOP, citem, inherited=self)

self.pDialog = DIALOG.progressBGDialog(100, self.pDialog, message='%s %s'%(self.pMSG,LANGUAGE(32025) if self.completeBuild else LANGUAGE(32135)))
self.log('build, completeBuild = %s, updated = %s, saved = %s'%(self.completeBuild,updated,self.saveChannelLineups()))
return self.completeBuild, updated
self.log('build, completeBuild = %s, updated = %s, saved = %s'%(self.completeBuild,bool(updated),self.saveChannelLineups()))
return self.completeBuild, bool(updated)


def getFileList(self, citem: dict, now: time, start: time) -> bool and list:
Expand Down
23 changes: 6 additions & 17 deletions plugin.video.pseudotv.live/resources/lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,21 @@ def wrapper(*args, **kwargs):
class Cache:
lock = Lock()
cache = SimpleCache()


def isCacheLocked(self):
return xbmcgui.Window(10000).getProperty('cacheLocker') == 'true'


def setCacheLocked(self, state=True):
xbmcgui.Window(10000).setProperty('%s.cacheLocker'%(ADDON_ID),str(state).lower())


@contextmanager
def cacheLocker(self): #simplecache is not thread safe, threadlock not avoiding collisions? Hack/Lazy avoidance.
monitor = MONITOR()
while not monitor.abortRequested() and self.isCacheLocked():
while not monitor.abortRequested() and xbmcgui.Window(10000).getProperty('%s.cacheLocker'%(ADDON_ID)) == 'true':
if monitor.waitForAbort(.0001): break
else: self.log('cacheLocker, waiting...')
del monitor
self.setCacheLocked(True)
xbmcgui.Window(10000).setProperty('%s.cacheLocker'%(ADDON_ID),'true')
try: yield self.log('cacheLocker, Locked!')
finally: self.setCacheLocked(False)
finally:
xbmcgui.Window(10000).setProperty('%s.cacheLocker'%(ADDON_ID),'false')


def cacheLocked(self):
return xbmcgui.Window(10000).getProperty('%s.cacheLocker'%(ADDON_ID)) == 'true'


def __init__(self, mem_cache=False, is_json=False):
self.cache.enable_mem_cache = mem_cache
self.cache.data_is_json = is_json
Expand All @@ -85,7 +74,7 @@ def getname(self, name):

def set(self, name, value, checksum=ADDON_VERSION, expiration=datetime.timedelta(minutes=15), json_data=False):
# with self.lock:
if value and not self.disable_cache and not self.cacheLocked():
if value and not self.disable_cache:
with self.cacheLocker():
self.log('set, name = %s, value = %s'%(self.getname(name),'%s...'%(str(value)[:128])))
self.cache.set(self.getname(name),value,checksum,expiration,json_data)
Expand All @@ -94,7 +83,7 @@ def set(self, name, value, checksum=ADDON_VERSION, expiration=datetime.timedelta

def get(self, name, checksum=ADDON_VERSION, json_data=False):
# with self.lock:
if not self.disable_cache and not self.cacheLocked():
if not self.disable_cache:
with self.cacheLocker():
try:
value = self.cache.get(self.getname(name),checksum,json_data)
Expand Down
6 changes: 0 additions & 6 deletions plugin.video.pseudotv.live/resources/lib/fileaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ 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
14 changes: 7 additions & 7 deletions plugin.video.pseudotv.live/resources/lib/fillers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ def getSingle(self, type, keys=['resources'], chance=False):
for key in keys:
tmpLST = self.builder.bctTypes.get(type,{}).get('items',{}).get(key.lower(),[])
if len(tmpLST) > 0: items.append(random.choice(tmpLST))
if len(items) == 0 and chance: items.extend(self.getSingle(type))#parse root for anything
items = setDictLST(items)
elif chance: items.extend(self.getSingle(type))
self.log('getSingle, type = %s, keys = %s, chance = %s, returning = %s'%(type,keys,chance,len(items)))
return items
return setDictLST(items)


def getMulti(self, type, keys=['resources'], count=1, chance=False):
Expand All @@ -136,23 +135,25 @@ def injectBCTs(self, citem, fileList):
else:
runtime = fileItem.get('duration',0)
if runtime == 0: continue

chtype = citem.get('type','')
chname = citem.get('name','')
fitem = fileItem.copy()
dbtype = fileItem.get('type','')
fgenre = (fileItem.get('genre') or citem.get('group') or '')
fmpaa = (self.convertMPAA(fileItem.get('mpaa')) or 'NR')
fcodec = (fileItem.get('streamdetails',{}).get('audio') or [{}])[0].get('codec','')
fgenre = (fileItem.get('genre') or citem.get('group') or '')
if isinstance(fgenre,list) and len(fgenre) > 0: fgenre = fgenre[0]

#pre roll - bumpers/ratings
preFileList = []
for ftype in ['ratings','bumpers']:
preIncludeTypes = {'ratings':MOVIE_TYPES ,'bumpers':TV_TYPES}[ftype]
preKeys = {'ratings':[fmpaa, fcodec],'bumpers':[chname, fgenre]}[ftype]
if self.builder.bctTypes[ftype].get('enabled',False) and dbtype.startswith(tuple(preIncludeTypes)) and chtype not in IGNORE_CHTYPE: preFileList.extend(self.getSingle(ftype, preKeys, chanceBool(self.builder.bctTypes[ftype].get('chance',0))))
if self.builder.bctTypes[ftype].get('enabled',False) and dbtype.startswith(tuple(preIncludeTypes)) and chtype not in IGNORE_CHTYPE:
preFileList.extend(self.getSingle(ftype, preKeys, chanceBool(self.builder.bctTypes[ftype].get('chance',0))))

for item in setDictLST(preFileList):
for item in preFileList:
if (item.get('duration') or 0) == 0: continue
else:
runtime += item.get('duration')
Expand All @@ -176,7 +177,6 @@ def injectBCTs(self, citem, fileList):
postFillCount = len(postFileList)

if len(postFileList) > 0:
postFileList = setDictLST(postFileList)
self.log('injectBCTs, post-roll current runtime %s, available runtime %s, available content %s'%(runtime, postFillRuntime,len(postFileList)))
while not self.builder.service.monitor.abortRequested() and postFillRuntime > 0 and postFillCount > 0:
if len(postFileList) == 0: break
Expand Down
23 changes: 12 additions & 11 deletions plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,19 @@ def KODI_LIVETV_SETTINGS(): #recommended Kodi LiveTV settings
'pvrmanager.startgroupchannelnumbersfromone':'false'}

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))
if not BUILTIN.getInfoBool('Playing','Player') or not BUILTIN.getInfoBool('HasMedia','Player'):
isEnabled = BUILTIN.getInfoBool('AddonIsEnabled(%s)'%(PVR_CLIENT_ID),'System')
if (state and isEnabled) or (not state and not isEnabled): return
if SETTINGS.getSettingBool('Enable_PVR_RELOAD'):
isPlaying = BUILTIN.getInfoBool('Playing','Player')
isEnabled = BUILTIN.getInfoBool('AddonIsEnabled(%s)'%(PVR_CLIENT_ID),'System')
if (state and isEnabled) or (not state and not isEnabled): return
elif not isPlaying and not PROPERTIES.isRunning('togglePVR'):
with PROPERTIES.setRunning('togglePVR'):
log('globals: togglePVR, state = %s, reverse = %s, wait = %s'%(state,reverse,wait))
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","params":{"addonid":"%s","enabled":%s}, "id": 1}'%(PVR_CLIENT_ID,str(state).lower()))
if reverse:
with BUILTIN.busy_dialog(isPlaying=BUILTIN.getInfoBool('Playing','Player')):
timerit(togglePVR)(wait,[not bool(state)])
DIALOG.notificationWait('%s: %s'%(PVR_CLIENT_NAME,LANGUAGE(32125)),wait=wait)
else: DIALOG.notificationWait(LANGUAGE(30023)%(PVR_CLIENT_NAME))
if reverse:
with BUILTIN.busy_dialog(isPlaying=BUILTIN.getInfoBool('Playing','Player')):
timerit(togglePVR)(wait,[not bool(state)])
DIALOG.notificationWait('%s: %s'%(PVR_CLIENT_NAME,LANGUAGE(32125)),wait=wait)
else: DIALOG.notificationWait(LANGUAGE(30023)%(PVR_CLIENT_NAME))

def isRadio(item):
if item.get('radio',False) or item.get('type') == "Music Genres": return True
Expand Down
6 changes: 4 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,18 @@ def __getMeta(payload):
from xmltvs import XMLTVS
from library import Library
from multiroom import Multiroom
xmltv = XMLTVS()
payload.pop('updated')
payload.pop('md5')
payload['library'] = Library().getLibrary()
payload['m3u'] = M3U().getM3U()
payload['xmltv'] = {'stations':XMLTVS().getChannels(), 'recordings':XMLTVS().getRecordings()}
payload['xmltv'] = {'stations':xmltv.getChannels(), 'recordings':xmltv.getRecordings(), 'programmes':dict([(key,datetime.datetime.fromtimestamp(time.time()).strftime(DTFORMAT)) for key, value in list(dict(xmltv.loadStopTimes()).items())])}
payload['servers'] = Multiroom().getDiscovery()
del xmltv
return payload

payload = __getMeta(self.getBonjour(inclChannels=True))
if inclDebug: payload['debug'] = loadJSON(self.property.getEXTProperty('%s.debug.log'%(ADDON_NAME))).get('DEBUG',{})
if inclDebug: payload['debug'] = loadJSON(self.property.getEXTProperty('%s.debug.log'%(ADDON_ID))).get('DEBUG',{})
payload['updated'] = datetime.datetime.fromtimestamp(time.time()).strftime(DTFORMAT)
payload['md5'] = getMD5(dumpJSON(payload))
return payload
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def log(event, level=xbmc.LOGDEBUG):
event = '%s-%s-%s'%(ADDON_ID, ADDON_VERSION, event)
if level >= DEBUG_LEVEL:
xbmc.log(event,level)
try: entries = json.loads(xbmcgui.Window(10000).getProperty('%s.debug.log'%(ADDON_NAME))).get('DEBUG',{})
try: entries = json.loads(xbmcgui.Window(10000).getProperty('%s.debug.log'%(ADDON_ID))).get('DEBUG',{})
except: entries = {}
entries.setdefault(DEBUG_NAMES[DEBUG_LEVEL],[]).append('%s - %s: %s'%(datetime.datetime.fromtimestamp(time.time()).strftime(DTFORMAT),DEBUG_NAMES[level],event))
xbmcgui.Window(10000).setProperty('%s.debug.log'%(ADDON_NAME),json.dumps({'DEBUG':entries}, indent=4))
if not xbmcgui.Window(10000).getProperty('%s.has.debug'%(ADDON_NAME)) == 'true': xbmcgui.Window(10000).setProperty('%s.has.debug'%(ADDON_NAME),'true')
xbmcgui.Window(10000).setProperty('%s.debug.log'%(ADDON_ID),json.dumps({'DEBUG':entries}, indent=4))
if not xbmcgui.Window(10000).getProperty('%s.has.debug'%(ADDON_ID)) == 'true': xbmcgui.Window(10000).setProperty('%s.has.debug'%(ADDON_ID),'true')

4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __loadChannels(self, name=''):
enabled = SETTINGS.getSettingList('Select_server')
friendly = SETTINGS.getFriendlyName()

if name == 'Auto':
if name == LANGUAGE(30022):
if len(channels) > 0: return channels
elif len(enabled) > 0:
for name in enabled:
Expand Down Expand Up @@ -779,7 +779,7 @@ def match(chname):
retval = DIALOG.yesnoDialog(LANGUAGE(32066), heading ='%s - %s'%(ADDON_NAME,LANGUAGE(32172)),
nolabel = LANGUAGE(32067), #Select
yeslabel = LANGUAGE(32068), #Browse
customlabel = LANGUAGE(32069)) #Auto
customlabel = LANGUAGE(30022)) #Auto

if retval == 0: chlogo = select(chname)
elif retval == 1: chlogo = browse(chname)
Expand Down
8 changes: 4 additions & 4 deletions plugin.video.pseudotv.live/resources/lib/multiroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ def enableZeroConf(self):
self.log('enableZeroConf')
if SETTINGS.getSetting('ZeroConf_Status') == '[COLOR=red][B]Offline[/B][/COLOR]':
if BUILTIN.getInfoLabel('Platform.Windows','System'):
return BUILTIN.executebuiltin('RunScript(special://home/addons/plugin.video.pseudotv.live/resources/lib/utilities.py, Show_ZeroConf_QR)')
elif DIALOG.yesnoDialog(message=LANGUAGE(30129)):
BUILTIN.executebuiltin('RunScript(special://home/addons/plugin.video.pseudotv.live/resources/lib/utilities.py, Show_ZeroConf_QR)')
if DIALOG.yesnoDialog(message=LANGUAGE(30129)):
if self.jsonRPC.setSettingValue("services.zeroconf","true"):
DIALOG.notificationDialog(LANGUAGE(32219)%('ZeroConf'))
DIALOG.notificationDialog(LANGUAGE(32219)%(LANGUAGE(30035)))
PROPERTIES.forceUpdateTime('chkKodiSettings')
else: DIALOG.notificationDialog(LANGUAGE(32219)%('ZeroConf Already'))
else: DIALOG.notificationDialog(LANGUAGE(32219)%(LANGUAGE(30034)))


def run(self):
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/overlaytool.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ def save(self):


def set(self, cntrl, posx, posy, auto=False):
self.log('set, cntrl = %s, posx,posy = (%s,%s) Auto? %s'%(cntrl, posx, posy, auto))
self.log('set, cntrl = %s, posx,posy = (%s,%s) %s? %s'%(cntrl, posx, posy, LANGUAGE(30022), auto))
if self.advRule: save = PROPERTIES.setProperty
else: save = SETTINGS.setSetting

if cntrl == self._channelBug:
if auto: save("Channel_Bug_Position_XY","Auto")
if auto: save("Channel_Bug_Position_XY",LANGUAGE(30022))
else: save("Channel_Bug_Position_XY","(%s,%s)"%(posx, posy))
elif cntrl == self._onNext:
if auto: save("On_Next_Position_XY","Auto")
if auto: save("On_Next_Position_XY",LANGUAGE(30022))
else: save("On_Next_Position_XY","(%s,%s)"%(posx, posy))


Expand Down
Loading

0 comments on commit dcfeb1e

Please sign in to comment.