]> xmof Git - DeDRM.git/commitdiff
Update for strange windows users on a network, and more xml verification fixes
authorApprentice Harper <apprenticeharper@gmail.com>
Thu, 20 Oct 2016 06:12:37 +0000 (07:12 +0100)
committerApprentice Harper <apprenticeharper@gmail.com>
Thu, 20 Oct 2016 06:12:37 +0000 (07:12 +0100)
Obok_calibre_plugin/obok_plugin.zip
Obok_calibre_plugin/obok_plugin/__init__.py
Obok_calibre_plugin/obok_plugin/obok/obok.py
Other_Tools/Kobo/obok.py

index 1e47967b4a39d37c239558a8f685ec42b2aab72e..7c0c62a5ba205602ea9ceed208cb7d3251819e0e 100644 (file)
Binary files a/Obok_calibre_plugin/obok_plugin.zip and b/Obok_calibre_plugin/obok_plugin.zip differ
index dffa99fa2a32ce5f34fd81c95c3252a2a56c6896..d652af57a78a5ea23e098ea9c08129a01f56db24 100644 (file)
@@ -19,7 +19,7 @@ except NameError:
 PLUGIN_NAME = 'Obok DeDRM'
 PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
 PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.')
-PLUGIN_VERSION_TUPLE = (6, 5, 2)
+PLUGIN_VERSION_TUPLE = (6, 5, 3)
 PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE])
 HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm'
 PLUGIN_AUTHORS = 'Anon'
index e744c2b65fb2ebdc0f07ff6e676f7dcb392bcc54..149d09c8bde96b3c77754d9d64ea8cc168a5566c 100644 (file)
@@ -1,6 +1,9 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
+# Version 3.2.3 October 2016
+# Fix for windows network user and more xml fixes
+#
 # Version 3.2.2 October 2016
 # Change to the way the new database version is handled.
 #
 #
 """Manage all Kobo books, either encrypted or DRM-free."""
 
-__version__ = '3.2.2'
+__version__ = '3.2.3'
 __about__ =  u"Obok v{0}\nCopyright © 2012-2016 Physisticated et al.".format(__version__)
 
 import sys
@@ -428,7 +431,8 @@ class KoboLibrary(object):
         macaddrs = []
         if sys.platform.startswith('win'):
             c = re.compile('\s(' + '[0-9a-f]{2}-' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
-            for line in os.popen('ipconfig /all'):
+            (p_in, p_out, p_err) = os.popen3('ipconfig /all')
+            for line in p_out:
                 m = c.search(line)
                 if m:
                     macaddrs.append(re.sub("-", ":", m.group(1)).upper())
@@ -587,6 +591,15 @@ class KoboFile(object):
             elif contents[:14]=="\xff\xfe<\x00?\x00x\x00m\x00l\x00":
                 # utf-16LE
                 return True
+            elif contents[:9]=="<!DOCTYPE" or contents[:12]=="\xef\xbb\xbf<!DOCTYPE":
+                # utf-8 of weird <!DOCTYPE start
+                return True
+            elif contents[:22]=="\xfe\xff\x00<\x00!\x00D\x00O\x00C\x00T\x00Y\x00P\x00E":
+                # utf-16BE of weird <!DOCTYPE start
+                return True
+            elif contents[:22]=="\xff\xfe<\x00!\x00D\x00O\x00C\x00T\x00Y\x00P\x00E\x00":
+                # utf-16LE of weird <!DOCTYPE start
+                return True
             else:
                 print u"Bad XML: {0}".format(contents[:8])
                 raise ValueError
index 9601113890b35bd63be69a85833adeb578f50c1a..149d09c8bde96b3c77754d9d64ea8cc168a5566c 100644 (file)
@@ -1,6 +1,9 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
+# Version 3.2.3 October 2016
+# Fix for windows network user and more xml fixes
+#
 # Version 3.2.2 October 2016
 # Change to the way the new database version is handled.
 #