Skip to content

Commit

Permalink
v.0.5.5l
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Nov 2, 2024
1 parent 62975bc commit a697fa1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 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.5k" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5l" 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 @@
728fa824c35698c31a14532af4cee510
6bb03f76f36267b5d3fdf294fe5c68dd
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.5k" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5l" 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: 2 additions & 0 deletions plugin.video.pseudotv.live/remotes/servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"uuid": "",
"name": "",
"host": "",
"remotes": {
},
"settings": {
},
"enabled": false,
Expand Down
25 changes: 13 additions & 12 deletions plugin.video.pseudotv.live/resources/lib/multiroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def hasServers(self, servers={}):
PROPERTIES.setServers(len(servers) > 0)
PROPERTIES.setEnabledServers(len(enabledServers) > 0)
SETTINGS.setSetting('Select_server','|'.join([LANGUAGE(32211)%({True:'green',False:'red'}[server.get('online',False)],server.get('name')) for server in enabledServers]))
for server in enabledServers:
online = server.get('online',False)
if self.getRemote(server['remotes'].get('remote')): server['online'] = True
else: server['online'] = False
if online != server['online']: DIALOG.notificationDialog('%s: %s'%(server.get('name'),LANGUAGE(32211)%({True:'green',False:'red'}[server.get('online',False)],{True:LANGUAGE(33130),False:LANGUAGE(30129)}[server.get('online',False)])))
return servers


Expand All @@ -73,33 +78,29 @@ def setDiscovery(self, servers={}):
return setJSON(SERVER_LOC,{"servers":self.hasServers(servers)})


@cacheit(expiration=datetime.timedelta(minutes=30),json_data=True)
@cacheit(expiration=datetime.timedelta(minutes=5), json_data=True)
def getRemote(self, remote):
self.log("getRemote, remote = %s"%(remote))
cacheName = 'getRemote.%s'%(remote)
response = getURL(remote,header={'Accept':'application/json'},json_data=True)
if response:
response = self.cache.set(cacheName, response, expiration=datetime.timedelta(days=MAX_GUIDEDAYS), json_data=True)
response['online'] = True
else:
response = (self.cache.get(cacheName, json_data=True) or {}) #retrieve cached response incase server is temporarily offline
if not response: response['online'] = False
return response

if response: return self.cache.set(cacheName, response, expiration=datetime.timedelta(days=MAX_GUIDEDAYS), json_data=True)
else: return self.cache.get(cacheName, json_data=True) #retrieve cached response incase server is temporarily offline


def addServer(self, payload={}):
if payload:
payload['online'] = True
servers = self.getDiscovery()
server = servers.get(payload.get('name'),{})
if not server:
self.log('addServer, payload = %s'%(payload))
payload['enabled'] = True #set enabled by default
DIALOG.notificationDialog('%s: %s'%(LANGUAGE(32047),payload.get('name')))
servers.update({payload.get('name'):payload})
else:
payload['enabled'] = server.get('enabled',False)
if payload['enabled']:
DIALOG.notificationDialog('%s: %s'%(server.get('name'),LANGUAGE(32211)%({True:'green',False:'red'}[payload.get('online',False)],{True:LANGUAGE(33130),False:LANGUAGE(30129)}[payload.get('online',False)])))
servers.update({payload.get('name'):payload})
if payload.get('md5',server.get('md5')) != server.get('md5'): servers.update({payload.get('name'):payload})

if self.setDiscovery(servers):
instancePath = SETTINGS.hasPVRInstance(server.get('name'))
if payload.get('enabled',False) and not instancePath: changed = SETTINGS.setPVRRemote(payload.get('host'),payload.get('name'))
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def chkInstanceID(self):
PROPERTIES.getInstanceID()


@cacheit(expiration=datetime.timedelta(days=28))
@cacheit(expiration=datetime.timedelta(days=28), checksum=1)
def chkWelcome(self):
self.log('chkWelcome')
return DIALOG.qrDialog(URL_WIKI,LANGUAGE(32216)%(ADDON_NAME))
Expand Down
Binary file not shown.

0 comments on commit a697fa1

Please sign in to comment.