From c2a583d5d7799cd19c54a46e9f520e30d55f8750 Mon Sep 17 00:00:00 2001 From: ysard Date: Thu, 4 Nov 2021 02:16:26 +0100 Subject: [PATCH 1/6] Fix bool cast typo --- resources/lib/dbus_utils.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) 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): From 7bfbcd3ecaea75dd6229be4db63d521cd710dc1c Mon Sep 17 00:00:00 2001 From: ysard Date: Thu, 4 Nov 2021 02:19:21 +0100 Subject: [PATCH 2/6] Fix crash on shutdown LibreELEC/LibreELEC.tv#5645 --- service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service.py b/service.py index d22ca4798..de62f93ed 100644 --- a/service.py +++ b/service.py @@ -3,6 +3,7 @@ # Copyright (C) 2013 Lutz Fiebach (lufie@openelec.tv) # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) +import gc import syspath import dbus_utils import oe @@ -104,6 +105,10 @@ def run(self): oe.stop_service() service_thread.stop() dbus_utils.LOOP_THREAD.stop() + # Fix crash on shutdown + # See https://github.com/LibreELEC/LibreELEC.tv/issues/5645 + del dbus_utils.BUS + gc.collect() if __name__ == '__main__': From b5b681bd10cbd5f7de6d9eaa78df484803e30ea8 Mon Sep 17 00:00:00 2001 From: ysard Date: Thu, 4 Nov 2021 21:17:51 +0100 Subject: [PATCH 3/6] Fix comment typo --- service.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/service.py b/service.py index de62f93ed..c06519581 100644 --- a/service.py +++ b/service.py @@ -105,8 +105,7 @@ def run(self): oe.stop_service() service_thread.stop() dbus_utils.LOOP_THREAD.stop() - # Fix crash on shutdown - # See https://github.com/LibreELEC/LibreELEC.tv/issues/5645 + # call garbage collection to workaround a crash on shutdown del dbus_utils.BUS gc.collect() From bce946b9f8881f80332fd5ec89bc5e39dd487d9b Mon Sep 17 00:00:00 2001 From: ysard Date: Fri, 5 Nov 2021 04:51:55 +0100 Subject: [PATCH 4/6] Fix idle_timeout setting assignment --- resources/lib/modules/services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' From 782cc74f70c32eacea4173af2b3a28dd299ade41 Mon Sep 17 00:00:00 2001 From: ysard Date: Sat, 6 Nov 2021 17:40:24 +0100 Subject: [PATCH 5/6] Fix typos --- resources/lib/modules/bluetooth.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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) From ca92b339f5736fed5aa8d1f65f3d1c2365995bfc Mon Sep 17 00:00:00 2001 From: ysard Date: Sat, 13 Nov 2021 18:33:03 +0100 Subject: [PATCH 6/6] Remove gc collect thanks to dbussy update --- service.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/service.py b/service.py index c06519581..807de6fc2 100644 --- a/service.py +++ b/service.py @@ -3,7 +3,6 @@ # Copyright (C) 2013 Lutz Fiebach (lufie@openelec.tv) # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) -import gc import syspath import dbus_utils import oe @@ -105,9 +104,8 @@ def run(self): oe.stop_service() service_thread.stop() dbus_utils.LOOP_THREAD.stop() - # call garbage collection to workaround a crash on shutdown + # workaround a crash on shutdown del dbus_utils.BUS - gc.collect() if __name__ == '__main__':