Merge fixes for new Kobo version and Linux support, update version number

This commit is contained in:
apprenticeharper 2016-01-11 06:40:15 +00:00
parent ecf1d76d90
commit 3e95168972
3 changed files with 15 additions and 2 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, 8) PLUGIN_VERSION_TUPLE = (6, 3, 5)
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

@ -1,10 +1,13 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Version 3.1.9 December 2015 # Version 6.3.5 January 2016
# Update for latest version of Windows Desktop app. # Update for latest version of Windows Desktop app.
# Support Kobo devices in the command line version. # Support Kobo devices in the command line version.
# #
# Version 3.1.9 November 2015
# Handle Kobo Desktop under wine on Linux
#
# Version 3.1.8 November 2015 # Version 3.1.8 November 2015
# Handle the case of Kobo Arc or Vox device (i.e. don't crash). # Handle the case of Kobo Arc or Vox device (i.e. don't crash).
# #
@ -338,6 +341,9 @@ class KoboLibrary(object):
self.kobodir = os.path.join(self.kobodir, u"Kobo", u"Kobo Desktop Edition") self.kobodir = os.path.join(self.kobodir, u"Kobo", u"Kobo Desktop Edition")
elif sys.platform.startswith('darwin'): elif sys.platform.startswith('darwin'):
self.kobodir = os.path.join(os.environ['HOME'], u"Library", u"Application Support", u"Kobo", u"Kobo Desktop Edition") self.kobodir = os.path.join(os.environ['HOME'], u"Library", u"Application Support", u"Kobo", u"Kobo Desktop Edition")
elif linux_path != None:
# Probably Linux, let's get the wine prefix and path to Kobo.
self.kobodir = os.path.join(linux_path, u"Local Settings", u"Application Data", u"Kobo", u"Kobo Desktop Edition")
# desktop versions use Kobo.sqlite # desktop versions use Kobo.sqlite
kobodb = os.path.join(self.kobodir, u"Kobo.sqlite") kobodb = os.path.join(self.kobodir, u"Kobo.sqlite")
# check for existence of file # check for existence of file
@ -413,6 +419,13 @@ class KoboLibrary(object):
for m in matches: for m in matches:
# print u"m:{0}".format(m[0]) # print u"m:{0}".format(m[0])
macaddrs.append(m[0].upper()) macaddrs.append(m[0].upper())
else:
# probably linux, let's try ipconfig under wine
c = re.compile('\s(' + '[0-9a-f]{2}-' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
for line in os.popen('ipconfig /all'):
m = c.search(line)
if m:
macaddrs.append(re.sub("-", ":", m.group(1)).upper())
# extend the list of macaddrs in any case with the serials # extend the list of macaddrs in any case with the serials
# cannot hurt ;-) # cannot hurt ;-)