From 821f9aa53c3e89f171ac0d0675424776c6a51d06 Mon Sep 17 00:00:00 2001 From: Paul MARCHAND Date: Tue, 7 Apr 2020 18:17:17 +0200 Subject: [PATCH] Fix for python3 - Update xbmc.python requirment - Fix code in lib and addon --- addon.xml | 2 +- default.py | 2 +- resources/lib/bridge.py | 6 +++--- resources/lib/settings.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addon.xml b/addon.xml index d207891..1459500 100755 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ - + diff --git a/default.py b/default.py index 3196d0c..f5317b6 100755 --- a/default.py +++ b/default.py @@ -256,7 +256,7 @@ def run(): ) for i in range(len(hue.ambilight_controller.lights)): algorithm.transition_colorspace( - hue, hue.ambilight_controller.lights.values()[i], hsv_ratios[i], ) + hue, list(hue.ambilight_controller.lights.values())[i], list(hsv_ratios)[i], ) except ZeroDivisionError: pass diff --git a/resources/lib/bridge.py b/resources/lib/bridge.py index 5f028b7..b5cadac 100644 --- a/resources/lib/bridge.py +++ b/resources/lib/bridge.py @@ -106,10 +106,10 @@ def _discover_upnp(): for _ in range(10): try: - sock.sendto(data, address) + sock.sendto(data.encode('utf-8'), address) recv, addr = sock.recvfrom(2048) - if 'IpBridge' in recv and 'description.xml' in recv: - bridge_ip = recv.split('LOCATION: http://')[1].split(':')[0] + if str('IpBridge').encode('utf-8') in recv and str('description.xml').encode('utf-8') in recv: + bridge_ip = str(recv).split('LOCATION: http://')[1].split(':')[0] break time.sleep(3) except socket.timeout: diff --git a/resources/lib/settings.py b/resources/lib/settings.py index c18ea68..8f93260 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -71,7 +71,7 @@ def readxml(self): def update(self, **kwargs): self.__dict__.update(**kwargs) - for k, v in kwargs.iteritems(): + for k, v in kwargs.items(): __addon__.setSetting(k, str(v)) def __repr__(self):