diff --git a/Obok_calibre_plugin/obok_plugin.zip b/Obok_calibre_plugin/obok_plugin.zip index c8fe1f8..9434421 100644 Binary files a/Obok_calibre_plugin/obok_plugin.zip and b/Obok_calibre_plugin/obok_plugin.zip differ diff --git a/Obok_calibre_plugin/obok_plugin/__init__.py b/Obok_calibre_plugin/obok_plugin/__init__.py index 5a52b40..dffa99f 100644 --- a/Obok_calibre_plugin/obok_plugin/__init__.py +++ b/Obok_calibre_plugin/obok_plugin/__init__.py @@ -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, 3, 6) +PLUGIN_VERSION_TUPLE = (6, 5, 2) PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE]) HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm' PLUGIN_AUTHORS = 'Anon' diff --git a/Obok_calibre_plugin/obok_plugin/obok/obok.py b/Obok_calibre_plugin/obok_plugin/obok/obok.py index 9720dcf..1e55499 100644 --- a/Obok_calibre_plugin/obok_plugin/obok/obok.py +++ b/Obok_calibre_plugin/obok_plugin/obok/obok.py @@ -1,6 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +# Version 3.2.1 September 2016 +# Update for v4.0 of Windows Desktop app. +# # Version 3.2.0 January 2016 # Update for latest version of Windows Desktop app. # Support Kobo devices in the command line version. @@ -136,13 +139,13 @@ # """Manage all Kobo books, either encrypted or DRM-free.""" -__version__ = '3.1.9' -__about__ = u"Obok v{0}\nCopyright © 2012-2015 Physisticated et al.".format(__version__) +__version__ = '3.2.1' +__about__ = u"Obok v{0}\nCopyright © 2012-2016 Physisticated et al.".format(__version__) import sys import os import subprocess -import sqlite3 +import apsw import base64 import binascii import re @@ -162,7 +165,7 @@ except ImportError: # print u"Cannot find xml.etree, disabling extraction of serial numbers" # List of all known hash keys -KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook'] +KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook','QJhwzAtXL'] class ENCRYPTIONError(Exception): pass @@ -355,7 +358,7 @@ class KoboLibrary(object): if (self.kobodir != u""): self.bookdir = os.path.join(self.kobodir, u"kepub") - self.__sqlite = sqlite3.connect(kobodb) + self.__sqlite = apsw.Connection(kobodb) self.__cursor = self.__sqlite.cursor() self._userkeys = [] self._books = [] @@ -390,11 +393,13 @@ class KoboLibrary(object): """Drm-free""" for f in os.listdir(self.bookdir): if(f not in self._volumeID): - row = self.__cursor.execute("SELECT Title, Attribution, Series FROM content WHERE ContentID = '" + f + "'").fetchone() - if row is not None: + try: + row = self.__cursor.execute("SELECT Title, Attribution, Series FROM content WHERE ContentID = '" + f + "'").next() fTitle = row[0] self._books.append(KoboBook(f, fTitle, self.__bookfile(f), 'drm-free', self.__cursor, author=row[1], series=row[2])) self._volumeID.append(f) + except StopIteration: + pass """Sort""" self._books.sort(key=lambda x: x.title) return self._books @@ -436,14 +441,9 @@ class KoboLibrary(object): def __getuserids (self): userids = [] cursor = self.__cursor.execute('SELECT UserID FROM user') - row = cursor.fetchone() - while row is not None: - try: - userid = row[0] - userids.append(userid) - except: - pass - row = cursor.fetchone() + for row in cursor.next(): + userid = row + userids.append(userid) return userids def __getuserkeys (self, macaddr): @@ -558,12 +558,19 @@ class KoboFile(object): Returns True if the content was checked, False if it was not checked.""" if self.mimetype == 'application/xhtml+xml': - if contents[:5]=="