mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
...
This commit is contained in:
parent
4a1ed673d7
commit
8ffeb0c222
@ -19,13 +19,20 @@ def node_mountpoint(node):
|
||||
return de_mangle(line[1])
|
||||
return None
|
||||
|
||||
class NoUDisks1(Exception):
|
||||
pass
|
||||
|
||||
class UDisks(object):
|
||||
|
||||
def __init__(self):
|
||||
self.bus = dbus.SystemBus()
|
||||
try:
|
||||
self.main = dbus.Interface(self.bus.get_object('org.freedesktop.UDisks',
|
||||
'/org/freedesktop/UDisks'), 'org.freedesktop.UDisks')
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if getattr(e, '_dbus_error_name', None) == 'org.freedesktop.DBus.Error.ServiceUnknown':
|
||||
raise NoUDisks1()
|
||||
raise
|
||||
|
||||
def device(self, device_node_path):
|
||||
devpath = self.main.FindDeviceByDeviceFile(device_node_path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user