Fix for crash when Arc or Vox is connected.

This commit is contained in:
apprenticeharper 2015-10-29 07:47:49 +00:00
parent 9434751a72
commit a13d08c3bc
5 changed files with 27 additions and 23 deletions

Binary file not shown.

View File

@ -19,7 +19,7 @@ except NameError:
PLUGIN_NAME = 'Obok DeDRM' PLUGIN_NAME = 'Obok DeDRM'
PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_') PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.') PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.')
PLUGIN_VERSION_TUPLE = (3, 1, 6) PLUGIN_VERSION_TUPLE = (3, 1, 8)
PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE]) PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE])
HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm' HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm'
PLUGIN_AUTHORS = 'Anon' PLUGIN_AUTHORS = 'Anon'

View File

@ -90,28 +90,29 @@ class InterfacePluginAction(InterfaceAction):
# #
# search for connected device in case serials are saved # search for connected device in case serials are saved
tmpserials = cfg['kobo_serials'] tmpserials = cfg['kobo_serials']
device = self.parent().device_manager.connected_device
device_path = None device_path = None
if (device): try:
device_path = device._main_prefix device = self.parent().device_manager.connected_device
debug_print("get_device_settings - device_path=", device_path) if (device):
# get serial from device_path/.adobe-digital-editions/device.xml device_path = device._main_prefix
if can_parse_xml: debug_print("get_device_settings - device_path=", device_path)
devicexml = os.path.join(device_path, '.adobe-digital-editions', 'device.xml') # get serial from device_path/.adobe-digital-editions/device.xml
debug_print("trying to load %s" % devicexml) if can_parse_xml:
if (os.path.exists(devicexml)): devicexml = os.path.join(device_path, '.adobe-digital-editions', 'device.xml')
debug_print("trying to parse %s" % devicexml) debug_print("trying to load %s" % devicexml)
xmltree = ET.parse(devicexml) if (os.path.exists(devicexml)):
for node in xmltree.iter(): debug_print("trying to parse %s" % devicexml)
if "deviceSerial" in node.tag: xmltree = ET.parse(devicexml)
serial = node.text for node in xmltree.iter():
debug_print ("found serial %s" % serial) if "deviceSerial" in node.tag:
tmpserials.append(serial) serial = node.text
break debug_print ("found serial %s" % serial)
tmpserials.append(serial)
break
else: else:
debug_print("didn't find device") debug_print("didn't find device")
except:
debug_print("Exception getting device path. Probably not an E-Ink Kobo device")
# Get the Kobo Library object (obok v3.01) # Get the Kobo Library object (obok v3.01)
self.library = KoboLibrary(tmpserials, device_path) self.library = KoboLibrary(tmpserials, device_path)

View File

@ -1,6 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Version 3.1.8 November 2015
# Handle the case of Kobo Arc or Vox device (i.e. don't crash).
#
# Version 3.1.7 October 2015 # Version 3.1.7 October 2015
# Handle the case of no device or database more gracefully. # Handle the case of no device or database more gracefully.
# #

View File

@ -1,7 +1,7 @@
obok_plugin.zip obok_plugin.zip
================ ================
This plugin will remove the DRM from Kobo ebooks download on Mac or Windows using the Kobo desktop application, or from Kobo ebooks on an attached Kobo reader. If both are available, ebooks will be read from the attached Kobo reader. To import from the desktop application, unplug the Kobo reader. This plugin will remove the DRM from Kobo ebooks download on Mac or Windows using the Kobo desktop application, or from Kobo ebooks on an attached E-Ink Kobo reader (but not a Kobo Arc or Kobo Vox). If both are available, ebooks will be read from the attached E-Ink Kobo reader. To import from the desktop application, unplug the Kobo reader.
Installation Installation