diff --git a/addons.xml b/addons.xml index b06eb1a7..05d776a0 100644 --- a/addons.xml +++ b/addons.xml @@ -1,6 +1,6 @@ - + diff --git a/addons.xml.md5 b/addons.xml.md5 index a79ea3de..b5ec3d40 100644 --- a/addons.xml.md5 +++ b/addons.xml.md5 @@ -1 +1 @@ -728fa824c35698c31a14532af4cee510 \ No newline at end of file +6bb03f76f36267b5d3fdf294fe5c68dd \ No newline at end of file diff --git a/plugin.video.pseudotv.live/addon.xml b/plugin.video.pseudotv.live/addon.xml index 880d4066..2e38a5af 100644 --- a/plugin.video.pseudotv.live/addon.xml +++ b/plugin.video.pseudotv.live/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/plugin.video.pseudotv.live/remotes/servers.json b/plugin.video.pseudotv.live/remotes/servers.json index 741f3f25..eef1e17e 100644 --- a/plugin.video.pseudotv.live/remotes/servers.json +++ b/plugin.video.pseudotv.live/remotes/servers.json @@ -6,6 +6,8 @@ "uuid": "", "name": "", "host": "", + "remotes": { + }, "settings": { }, "enabled": false, diff --git a/plugin.video.pseudotv.live/resources/lib/multiroom.py b/plugin.video.pseudotv.live/resources/lib/multiroom.py index 665a672a..26e77568 100644 --- a/plugin.video.pseudotv.live/resources/lib/multiroom.py +++ b/plugin.video.pseudotv.live/resources/lib/multiroom.py @@ -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 @@ -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')) diff --git a/plugin.video.pseudotv.live/resources/lib/tasks.py b/plugin.video.pseudotv.live/resources/lib/tasks.py index 590b60f1..16f26391 100644 --- a/plugin.video.pseudotv.live/resources/lib/tasks.py +++ b/plugin.video.pseudotv.live/resources/lib/tasks.py @@ -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)) diff --git a/zips/plugin.video.pseudotv.live/plugin.video.pseudotv.live-0.5.5l.zip b/zips/plugin.video.pseudotv.live/plugin.video.pseudotv.live-0.5.5l.zip new file mode 100644 index 00000000..3add69a6 Binary files /dev/null and b/zips/plugin.video.pseudotv.live/plugin.video.pseudotv.live-0.5.5l.zip differ