Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown crash #245

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions resources/lib/dbus_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
16 changes: 5 additions & 11 deletions resources/lib/modules/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,15 @@ 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))

@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))
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/modules/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 2 additions & 0 deletions service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down