From 6e90904d91606c62bec8bab2ae0d5424dd76506c Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 1 Apr 2014 21:48:46 +0200 Subject: [PATCH] Fix for autodetection of optical devices --- openlp/plugins/media/forms/mediaclipselectorform.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/media/forms/mediaclipselectorform.py b/openlp/plugins/media/forms/mediaclipselectorform.py index 1472052a1..005f821a4 100644 --- a/openlp/plugins/media/forms/mediaclipselectorform.py +++ b/openlp/plugins/media/forms/mediaclipselectorform.py @@ -441,18 +441,20 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector): if type == 5: self.media_path_combobox.addItem('%s:\\' % letter) except Exception as e: - log.debug("Exception while looking for optical drives: ", e) + log.debug('Exception while looking for optical drives: ', e) bitmask >>= 1 elif sys.platform.startswith('linux'): # Get disc devices from dbus and find the ones that are optical bus = dbus.SystemBus() - udev_manager_obj = bus.get_object("org.freedesktop.UDisks", "/org/freedesktop/UDisks") + udev_manager_obj = bus.get_object('org.freedesktop.UDisks', '/org/freedesktop/UDisks') udev_manager = dbus.Interface(udev_manager_obj, 'org.freedesktop.UDisks') for dev in udev_manager.EnumerateDevices(): device_obj = bus.get_object("org.freedesktop.UDisks", dev) device_props = dbus.Interface(device_obj, dbus.PROPERTIES_IFACE) - if device_props.Get('org.freedesktop.UDisks.Device', "DeviceIsOpticalDisc"): - self.media_path_combobox.addItem(device_props.Get('org.freedesktop.UDisks.Device', "DeviceFile")) + if device_props.Get('org.freedesktop.UDisks.Device', 'DeviceIsDrive'): + drive_props = device_props.Get('org.freedesktop.UDisks.Device', 'DriveMediaCompatibility') + if any('optical' in prop for prop in drive_props): + self.media_path_combobox.addItem(device_props.Get('org.freedesktop.UDisks.Device', 'DeviceFile')) elif sys.platform.startswith('darwin'): # Look for DVD folders in devices to find optical devices volumes = os.listdir('/Volumes')