diff --git a/resources/lib/dbus_utils.py b/resources/lib/dbus_utils.py index b0ba5f33f..e846ebcd7 100644 --- a/resources/lib/dbus_utils.py +++ b/resources/lib/dbus_utils.py @@ -54,15 +54,6 @@ def manager_unregister_agent(self): pass -class Bool(int): - - def __new__(cls, value): - return int.__new__(cls, bool(value)) - - def __str__(self): - return '1' if self == True else '0' - - class LoopThread(threading.Thread): def __init__(self, loop): @@ -92,7 +83,7 @@ def list_names(): def convert_from_dbussy(data): if isinstance(data, bool): - return Bool(data) + return str(int(data)) if isinstance(data, dict): return {key: convert_from_dbussy(data[key]) for key in data.keys()} if isinstance(data, list): diff --git a/resources/lib/modules/bluetooth.py b/resources/lib/modules/bluetooth.py index d4cf247e4..fb47493bc 100644 --- a/resources/lib/modules/bluetooth.py +++ b/resources/lib/modules/bluetooth.py @@ -177,10 +177,7 @@ def trust_connect_device(self, listItem=None): @log.log_function() def enable_device_standby(self, listItem=None): devices = oe.read_setting('bluetooth', 'standby') - if devices is not None: - devices = devices.split(',') - else: - devices = [] + devices = devices.split(',') if devices else [] if not listItem.getProperty('entry') in devices: devices.append(listItem.getProperty('entry')) oe.write_setting('bluetooth', 'standby', ','.join(devices)) @@ -188,10 +185,7 @@ def enable_device_standby(self, listItem=None): @log.log_function() def disable_device_standby(self, listItem=None): devices = oe.read_setting('bluetooth', 'standby') - if devices is not None: - devices = devices.split(',') - else: - devices = [] + devices = devices.split(',') if devices else [] if listItem.getProperty('entry') in devices: devices.remove(listItem.getProperty('entry')) oe.write_setting('bluetooth', 'standby', ','.join(devices)) @@ -417,9 +411,9 @@ def open_context_menu(self, listItem): } items = [] actions = [] - for key in list(values.keys()): - items.append(values[key]['text']) - actions.append(values[key]['action']) + for key, value in values.items(): + items.append(value['text']) + actions.append(value['action']) select_window = xbmcgui.Dialog() title = oe._(32012) result = select_window.select(title, items) diff --git a/resources/lib/modules/services.py b/resources/lib/modules/services.py index 10281ae99..23e44c6ea 100644 --- a/resources/lib/modules/services.py +++ b/resources/lib/modules/services.py @@ -358,7 +358,7 @@ def load_values(self): value = oe.read_setting('bluetooth', 'idle_timeout') if not value: value = '0' - self.struct['bluez']['settings']['idle_timeout']['value'] = oe.read_setting('bluetooth', 'idle_timeout') + self.struct['bluez']['settings']['idle_timeout']['value'] = value else: self.struct['bluez']['hidden'] = 'true' diff --git a/service.py b/service.py index d22ca4798..807de6fc2 100644 --- a/service.py +++ b/service.py @@ -104,6 +104,8 @@ def run(self): oe.stop_service() service_thread.stop() dbus_utils.LOOP_THREAD.stop() + # workaround a crash on shutdown + del dbus_utils.BUS if __name__ == '__main__':